3 # User Mike Hommey <mh+mozilla@glandium.org>
5 # Node ID 42478b7856c0f10c862a1234e4e01040ee99deea
6 # Parent 6eccfe79d02f025ada20d121eda69cf0b7921f16
7 Bug 1531309 - Don't use __PRETTY_FUNCTION__ or __FUNCTION__ as format strings. r=sylvestre
9 __PRETTY_FUNCTION__ and __FUNCTION__ are not guaranteed to be a string
10 literal, and only string literals should be used as format strings. GCC
11 9 complains about this with -Werror=format-security.
13 Differential Revision: https://phabricator.services.mozilla.com/D42459
15 diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp
16 --- a/dom/media/systemservices/CamerasChild.cpp
17 +++ b/dom/media/systemservices/CamerasChild.cpp
18 @@ -153,36 +153,36 @@ int CamerasChild::AddDeviceChangeCallbac
20 // So here we setup camera engine via EnsureInitialized(aCapEngine)
22 EnsureInitialized(CameraEngine);
23 return DeviceChangeCallback::AddDeviceChangeCallback(aCallback);
26 mozilla::ipc::IPCResult CamerasChild::RecvReplyFailure(void) {
27 - LOG((__PRETTY_FUNCTION__));
28 + LOG(("%s", __PRETTY_FUNCTION__));
29 MonitorAutoLock monitor(mReplyMonitor);
30 mReceivedReply = true;
31 mReplySuccess = false;
36 mozilla::ipc::IPCResult CamerasChild::RecvReplySuccess(void) {
37 - LOG((__PRETTY_FUNCTION__));
38 + LOG(("%s", __PRETTY_FUNCTION__));
39 MonitorAutoLock monitor(mReplyMonitor);
40 mReceivedReply = true;
46 mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCapabilities(
48 - LOG((__PRETTY_FUNCTION__));
49 + LOG(("%s", __PRETTY_FUNCTION__));
50 MonitorAutoLock monitor(mReplyMonitor);
51 mReceivedReply = true;
53 mReplyInteger = numdev;
58 @@ -257,51 +257,51 @@ bool CamerasChild::DispatchToParent(nsIR
65 int CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine,
66 const char* deviceUniqueIdUTF8) {
67 - LOG((__PRETTY_FUNCTION__));
68 + LOG(("%s", __PRETTY_FUNCTION__));
69 LOG(("NumberOfCapabilities for %s", deviceUniqueIdUTF8));
70 nsCString unique_id(deviceUniqueIdUTF8);
71 nsCOMPtr<nsIRunnable> runnable =
72 mozilla::NewRunnableMethod<CaptureEngine, nsCString>(
73 "camera::PCamerasChild::SendNumberOfCapabilities", this,
74 &CamerasChild::SendNumberOfCapabilities, aCapEngine, unique_id);
75 LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger);
76 LOG(("Capture capability count: %d", dispatcher.ReturnValue()));
77 return dispatcher.ReturnValue();
80 int CamerasChild::NumberOfCaptureDevices(CaptureEngine aCapEngine) {
81 - LOG((__PRETTY_FUNCTION__));
82 + LOG(("%s", __PRETTY_FUNCTION__));
83 nsCOMPtr<nsIRunnable> runnable = mozilla::NewRunnableMethod<CaptureEngine>(
84 "camera::PCamerasChild::SendNumberOfCaptureDevices", this,
85 &CamerasChild::SendNumberOfCaptureDevices, aCapEngine);
86 LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger);
87 LOG(("Capture Devices: %d", dispatcher.ReturnValue()));
88 return dispatcher.ReturnValue();
91 mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCaptureDevices(
93 - LOG((__PRETTY_FUNCTION__));
94 + LOG(("%s", __PRETTY_FUNCTION__));
95 MonitorAutoLock monitor(mReplyMonitor);
96 mReceivedReply = true;
98 mReplyInteger = numdev;
103 int CamerasChild::EnsureInitialized(CaptureEngine aCapEngine) {
104 - LOG((__PRETTY_FUNCTION__));
105 + LOG(("%s", __PRETTY_FUNCTION__));
106 nsCOMPtr<nsIRunnable> runnable = mozilla::NewRunnableMethod<CaptureEngine>(
107 "camera::PCamerasChild::SendEnsureInitialized", this,
108 &CamerasChild::SendEnsureInitialized, aCapEngine);
109 LockAndDispatch<> dispatcher(this, __func__, runnable, 0, mReplyInteger);
110 LOG(("Capture Devices: %d", dispatcher.ReturnValue()));
111 return dispatcher.ReturnValue();
114 @@ -320,17 +320,17 @@ int CamerasChild::GetCaptureCapability(
115 if (dispatcher.Success()) {
116 capability = mReplyCapability;
118 return dispatcher.ReturnValue();
121 mozilla::ipc::IPCResult CamerasChild::RecvReplyGetCaptureCapability(
122 const VideoCaptureCapability& ipcCapability) {
123 - LOG((__PRETTY_FUNCTION__));
124 + LOG(("%s", __PRETTY_FUNCTION__));
125 MonitorAutoLock monitor(mReplyMonitor);
126 mReceivedReply = true;
127 mReplySuccess = true;
128 mReplyCapability.width = ipcCapability.width();
129 mReplyCapability.height = ipcCapability.height();
130 mReplyCapability.maxFPS = ipcCapability.maxFPS();
131 mReplyCapability.videoType =
132 static_cast<webrtc::VideoType>(ipcCapability.videoType());
133 @@ -338,17 +338,17 @@ mozilla::ipc::IPCResult CamerasChild::Re
138 int CamerasChild::GetCaptureDevice(
139 CaptureEngine aCapEngine, unsigned int list_number, char* device_nameUTF8,
140 const unsigned int device_nameUTF8Length, char* unique_idUTF8,
141 const unsigned int unique_idUTF8Length, bool* scary) {
142 - LOG((__PRETTY_FUNCTION__));
143 + LOG(("%s", __PRETTY_FUNCTION__));
144 nsCOMPtr<nsIRunnable> runnable =
145 mozilla::NewRunnableMethod<CaptureEngine, unsigned int>(
146 "camera::PCamerasChild::SendGetCaptureDevice", this,
147 &CamerasChild::SendGetCaptureDevice, aCapEngine, list_number);
148 LockAndDispatch<> dispatcher(this, __func__, runnable, -1, mZero);
149 if (dispatcher.Success()) {
150 base::strlcpy(device_nameUTF8, mReplyDeviceName.get(),
151 device_nameUTF8Length);
152 @@ -359,32 +359,32 @@ int CamerasChild::GetCaptureDevice(
153 LOG(("Got %s name %s id", device_nameUTF8, unique_idUTF8));
155 return dispatcher.ReturnValue();
158 mozilla::ipc::IPCResult CamerasChild::RecvReplyGetCaptureDevice(
159 const nsCString& device_name, const nsCString& device_id,
161 - LOG((__PRETTY_FUNCTION__));
162 + LOG(("%s", __PRETTY_FUNCTION__));
163 MonitorAutoLock monitor(mReplyMonitor);
164 mReceivedReply = true;
165 mReplySuccess = true;
166 mReplyDeviceName = device_name;
167 mReplyDeviceID = device_id;
173 int CamerasChild::AllocateCaptureDevice(
174 CaptureEngine aCapEngine, const char* unique_idUTF8,
175 const unsigned int unique_idUTF8Length, int& aStreamId,
176 const mozilla::ipc::PrincipalInfo& aPrincipalInfo) {
177 - LOG((__PRETTY_FUNCTION__));
178 + LOG(("%s", __PRETTY_FUNCTION__));
179 nsCString unique_id(unique_idUTF8);
180 nsCOMPtr<nsIRunnable> runnable =
181 mozilla::NewRunnableMethod<CaptureEngine, nsCString,
182 const mozilla::ipc::PrincipalInfo&>(
183 "camera::PCamerasChild::SendAllocateCaptureDevice", this,
184 &CamerasChild::SendAllocateCaptureDevice, aCapEngine, unique_id,
186 LockAndDispatch<> dispatcher(this, __func__, runnable, -1, mZero);
187 @@ -392,28 +392,28 @@ int CamerasChild::AllocateCaptureDevice(
188 LOG(("Capture Device allocated: %d", mReplyInteger));
189 aStreamId = mReplyInteger;
191 return dispatcher.ReturnValue();
194 mozilla::ipc::IPCResult CamerasChild::RecvReplyAllocateCaptureDevice(
196 - LOG((__PRETTY_FUNCTION__));
197 + LOG(("%s", __PRETTY_FUNCTION__));
198 MonitorAutoLock monitor(mReplyMonitor);
199 mReceivedReply = true;
200 mReplySuccess = true;
201 mReplyInteger = numdev;
206 int CamerasChild::ReleaseCaptureDevice(CaptureEngine aCapEngine,
207 const int capture_id) {
208 - LOG((__PRETTY_FUNCTION__));
209 + LOG(("%s", __PRETTY_FUNCTION__));
210 nsCOMPtr<nsIRunnable> runnable =
211 mozilla::NewRunnableMethod<CaptureEngine, int>(
212 "camera::PCamerasChild::SendReleaseCaptureDevice", this,
213 &CamerasChild::SendReleaseCaptureDevice, aCapEngine, capture_id);
214 LockAndDispatch<> dispatcher(this, __func__, runnable, -1, mZero);
215 return dispatcher.ReturnValue();
218 @@ -437,42 +437,42 @@ void CamerasChild::RemoveCallback(const
224 int CamerasChild::StartCapture(CaptureEngine aCapEngine, const int capture_id,
225 webrtc::VideoCaptureCapability& webrtcCaps,
227 - LOG((__PRETTY_FUNCTION__));
228 + LOG(("%s", __PRETTY_FUNCTION__));
229 AddCallback(aCapEngine, capture_id, cb);
230 VideoCaptureCapability capCap(
231 webrtcCaps.width, webrtcCaps.height, webrtcCaps.maxFPS,
232 static_cast<int>(webrtcCaps.videoType), webrtcCaps.interlaced);
233 nsCOMPtr<nsIRunnable> runnable =
234 mozilla::NewRunnableMethod<CaptureEngine, int, VideoCaptureCapability>(
235 "camera::PCamerasChild::SendStartCapture", this,
236 &CamerasChild::SendStartCapture, aCapEngine, capture_id, capCap);
237 LockAndDispatch<> dispatcher(this, __func__, runnable, -1, mZero);
238 return dispatcher.ReturnValue();
241 int CamerasChild::FocusOnSelectedSource(CaptureEngine aCapEngine,
242 const int aCaptureId) {
243 - LOG((__PRETTY_FUNCTION__));
244 + LOG(("%s", __PRETTY_FUNCTION__));
245 nsCOMPtr<nsIRunnable> runnable =
246 mozilla::NewRunnableMethod<CaptureEngine, int>(
247 "camera::PCamerasChild::SendFocusOnSelectedSource", this,
248 &CamerasChild::SendFocusOnSelectedSource, aCapEngine, aCaptureId);
249 LockAndDispatch<> dispatcher(this, __func__, runnable, -1, mZero);
250 return dispatcher.ReturnValue();
253 int CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id) {
254 - LOG((__PRETTY_FUNCTION__));
255 + LOG(("%s", __PRETTY_FUNCTION__));
256 nsCOMPtr<nsIRunnable> runnable =
257 mozilla::NewRunnableMethod<CaptureEngine, int>(
258 "camera::PCamerasChild::SendStopCapture", this,
259 &CamerasChild::SendStopCapture, aCapEngine, capture_id);
260 LockAndDispatch<> dispatcher(this, __func__, runnable, -1, mZero);
261 if (dispatcher.Success()) {
262 RemoveCallback(aCapEngine, capture_id);
264 diff --git a/dom/media/systemservices/CamerasParent.cpp b/dom/media/systemservices/CamerasParent.cpp
265 --- a/dom/media/systemservices/CamerasParent.cpp
266 +++ b/dom/media/systemservices/CamerasParent.cpp
267 @@ -97,17 +97,17 @@ StaticMutex CamerasParent::sMutex;
268 // - the IPC thread on which PBackground is running and which receives and
270 // - a thread which will execute the actual (possibly slow) camera access
271 // called "VideoCapture". On Windows this is a thread with an event loop
272 // suitable for UI access.
274 // InputObserver is owned by CamerasParent, and it has a ref to CamerasParent
275 void InputObserver::OnDeviceChange() {
276 - LOG((__PRETTY_FUNCTION__));
277 + LOG(("%s", __PRETTY_FUNCTION__));
280 RefPtr<InputObserver> self(this);
281 RefPtr<nsIRunnable> ipc_runnable = NewRunnableFrom([self]() {
282 if (self->mParent->IsShuttingDown()) {
283 return NS_ERROR_FAILURE;
285 Unused << self->mParent->SendDeviceChange();
286 @@ -196,17 +196,17 @@ nsresult CamerasParent::DispatchToVideoC
287 if (!sVideoCaptureThread || !sVideoCaptureThread->IsRunning()) {
288 return NS_ERROR_FAILURE;
290 sVideoCaptureThread->message_loop()->PostTask(event.forget());
294 void CamerasParent::StopVideoCapture() {
295 - LOG((__PRETTY_FUNCTION__));
296 + LOG(("%s", __PRETTY_FUNCTION__));
297 // We are called from the main thread (xpcom-shutdown) or
298 // from PBackground (when the Actor shuts down).
299 // Shut down the WebRTC stack (on the capture thread)
300 RefPtr<CamerasParent> self(this);
301 DebugOnly<nsresult> rv =
302 DispatchToVideoCaptureThread(NewRunnableFrom([self]() {
303 MonitorAutoLock lock(*(self->sThreadMonitor));
304 self->CloseEngines();
305 @@ -278,17 +278,17 @@ int CamerasParent::DeliverFrameOverIPC(C
309 ShmemBuffer CamerasParent::GetBuffer(size_t aSize) {
310 return mShmemPool.GetIfAvailable(aSize);
313 void CallbackHelper::OnFrame(const webrtc::VideoFrame& aVideoFrame) {
314 - LOG_VERBOSE((__PRETTY_FUNCTION__));
315 + LOG_VERBOSE(("%s", __PRETTY_FUNCTION__));
316 RefPtr<DeliverFrameRunnable> runnable = nullptr;
317 // Get frame properties
318 camera::VideoFrameProperties properties;
319 VideoFrameUtils::InitFrameBufferProperties(aVideoFrame, properties);
320 // Get a shared memory buffer to copy the frame data into
321 ShmemBuffer shMemBuffer = mParent->GetBuffer(properties.bufferSize());
322 if (!shMemBuffer.Valid()) {
323 // Either we ran out of buffers or they're not the right size yet
324 @@ -314,17 +314,17 @@ void CallbackHelper::OnFrame(const webrt
326 mozilla::ipc::IPCResult CamerasParent::RecvReleaseFrame(
327 mozilla::ipc::Shmem&& s) {
328 mShmemPool.Put(ShmemBuffer(s));
332 bool CamerasParent::SetupEngine(CaptureEngine aCapEngine) {
333 - LOG((__PRETTY_FUNCTION__));
334 + LOG(("%s", __PRETTY_FUNCTION__));
335 StaticRefPtr<VideoEngine>& engine = sEngines[aCapEngine];
338 UniquePtr<webrtc::CaptureDeviceInfo> captureDeviceInfo;
339 auto config = MakeUnique<webrtc::Config>();
341 switch (aCapEngine) {
343 @@ -366,17 +366,17 @@ bool CamerasParent::SetupEngine(CaptureE
344 device_info->RegisterVideoInputFeedBack(mCameraObserver);
351 void CamerasParent::CloseEngines() {
352 - LOG((__PRETTY_FUNCTION__));
353 + LOG(("%s", __PRETTY_FUNCTION__));
357 MOZ_ASSERT(sVideoCaptureThread->thread_id() == PlatformThread::CurrentId());
360 while (mCallbacks.Length()) {
361 auto capEngine = mCallbacks[0]->mCapEngine;
362 @@ -406,17 +406,17 @@ void CamerasParent::CloseEngines() {
367 mWebRTCAlive = false;
370 VideoEngine* CamerasParent::EnsureInitialized(int aEngine) {
371 - LOG_VERBOSE((__PRETTY_FUNCTION__));
372 + LOG_VERBOSE(("%s", __PRETTY_FUNCTION__));
373 // We're shutting down, don't try to do new WebRTC ops.
377 CaptureEngine capEngine = static_cast<CaptureEngine>(aEngine);
378 if (!SetupEngine(capEngine)) {
379 LOG(("CamerasParent failed to initialize engine"));
381 @@ -427,17 +427,17 @@ VideoEngine* CamerasParent::EnsureInitia
383 // Dispatch the runnable to do the camera operation on the
384 // specific Cameras thread, preventing us from blocking, and
385 // chain a runnable to send back the result on the IPC thread.
386 // It would be nice to get rid of the code duplication here,
387 // perhaps via Promises.
388 mozilla::ipc::IPCResult CamerasParent::RecvNumberOfCaptureDevices(
389 const CaptureEngine& aCapEngine) {
390 - LOG((__PRETTY_FUNCTION__));
391 + LOG(("%s", __PRETTY_FUNCTION__));
392 LOG(("CaptureEngine=%d", aCapEngine));
393 RefPtr<CamerasParent> self(this);
394 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine]() {
396 if (auto engine = self->EnsureInitialized(aCapEngine)) {
397 if (auto devInfo = engine->GetOrCreateVideoCaptureDeviceInfo()) {
398 num = devInfo->NumberOfDevices();
400 @@ -461,17 +461,17 @@ mozilla::ipc::IPCResult CamerasParent::R
403 DispatchToVideoCaptureThread(webrtc_runnable);
407 mozilla::ipc::IPCResult CamerasParent::RecvEnsureInitialized(
408 const CaptureEngine& aCapEngine) {
409 - LOG((__PRETTY_FUNCTION__));
410 + LOG(("%s", __PRETTY_FUNCTION__));
412 RefPtr<CamerasParent> self(this);
413 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine]() {
414 bool result = self->EnsureInitialized(aCapEngine);
416 RefPtr<nsIRunnable> ipc_runnable = NewRunnableFrom([self, result]() {
417 if (!self->mChildIsAlive) {
418 return NS_ERROR_FAILURE;
419 @@ -491,17 +491,17 @@ mozilla::ipc::IPCResult CamerasParent::R
422 DispatchToVideoCaptureThread(webrtc_runnable);
426 mozilla::ipc::IPCResult CamerasParent::RecvNumberOfCapabilities(
427 const CaptureEngine& aCapEngine, const nsCString& unique_id) {
428 - LOG((__PRETTY_FUNCTION__));
429 + LOG(("%s", __PRETTY_FUNCTION__));
430 LOG(("Getting caps for %s", unique_id.get()));
432 RefPtr<CamerasParent> self(this);
433 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, unique_id,
436 if (auto engine = self->EnsureInitialized(aCapEngine)) {
437 if (auto devInfo = engine->GetOrCreateVideoCaptureDeviceInfo()) {
438 @@ -528,17 +528,17 @@ mozilla::ipc::IPCResult CamerasParent::R
440 DispatchToVideoCaptureThread(webrtc_runnable);
444 mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureCapability(
445 const CaptureEngine& aCapEngine, const nsCString& unique_id,
447 - LOG((__PRETTY_FUNCTION__));
448 + LOG(("%s", __PRETTY_FUNCTION__));
449 LOG(("RecvGetCaptureCapability: %s %d", unique_id.get(), num));
451 RefPtr<CamerasParent> self(this);
452 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, unique_id,
454 webrtc::VideoCaptureCapability webrtcCaps;
456 if (auto engine = self->EnsureInitialized(aCapEngine)) {
457 @@ -581,17 +581,17 @@ mozilla::ipc::IPCResult CamerasParent::R
460 DispatchToVideoCaptureThread(webrtc_runnable);
464 mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureDevice(
465 const CaptureEngine& aCapEngine, const int& aListNumber) {
466 - LOG((__PRETTY_FUNCTION__));
467 + LOG(("%s", __PRETTY_FUNCTION__));
469 RefPtr<CamerasParent> self(this);
470 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine,
472 char deviceName[MediaEngineSource::kMaxDeviceNameLength];
473 char deviceUniqueId[MediaEngineSource::kMaxUniqueIdLength];
476 @@ -751,17 +751,17 @@ int CamerasParent::ReleaseCaptureDevice(
477 if (auto engine = EnsureInitialized(aCapEngine)) {
478 error = engine->ReleaseVideoCapture(capnum);
483 mozilla::ipc::IPCResult CamerasParent::RecvReleaseCaptureDevice(
484 const CaptureEngine& aCapEngine, const int& numdev) {
485 - LOG((__PRETTY_FUNCTION__));
486 + LOG(("%s", __PRETTY_FUNCTION__));
487 LOG(("RecvReleaseCamera device nr %d", numdev));
489 RefPtr<CamerasParent> self(this);
490 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine,
492 int error = self->ReleaseCaptureDevice(aCapEngine, numdev);
493 RefPtr<nsIRunnable> ipc_runnable = NewRunnableFrom([self, error, numdev]() {
494 if (!self->mChildIsAlive) {
495 @@ -783,22 +783,22 @@ mozilla::ipc::IPCResult CamerasParent::R
497 DispatchToVideoCaptureThread(webrtc_runnable);
501 mozilla::ipc::IPCResult CamerasParent::RecvStartCapture(
502 const CaptureEngine& aCapEngine, const int& capnum,
503 const VideoCaptureCapability& ipcCaps) {
504 - LOG((__PRETTY_FUNCTION__));
505 + LOG(("%s", __PRETTY_FUNCTION__));
507 RefPtr<CamerasParent> self(this);
508 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine, capnum,
510 - LOG((__PRETTY_FUNCTION__));
511 + LOG(("%s", __PRETTY_FUNCTION__));
512 CallbackHelper** cbh;
514 if (self->EnsureInitialized(aCapEngine)) {
515 cbh = self->mCallbacks.AppendElement(new CallbackHelper(
516 static_cast<CaptureEngine>(aCapEngine), capnum, self));
518 self->sEngines[aCapEngine]->WithEntry(
519 capnum, [&capnum, &aCapEngine, &error, &ipcCaps, &cbh,
520 @@ -910,17 +910,17 @@ mozilla::ipc::IPCResult CamerasParent::R
523 DispatchToVideoCaptureThread(webrtc_runnable);
527 mozilla::ipc::IPCResult CamerasParent::RecvFocusOnSelectedSource(
528 const CaptureEngine& aCapEngine, const int& aCapNum) {
529 - LOG((__PRETTY_FUNCTION__));
530 + LOG(("%s", __PRETTY_FUNCTION__));
531 RefPtr<Runnable> webrtc_runnable = NewRunnableFrom(
532 [self = RefPtr<CamerasParent>(this), aCapEngine, aCapNum]() {
533 if (auto engine = self->EnsureInitialized(aCapEngine)) {
534 engine->WithEntry(aCapNum, [self](VideoEngine::CaptureEntry& cap) {
535 if (cap.VideoCapture()) {
536 bool result = cap.VideoCapture()->FocusOnSelectedSource();
537 RefPtr<nsIRunnable> ipc_runnable =
538 NewRunnableFrom([self, result]() {
539 @@ -972,17 +972,17 @@ void CamerasParent::StopCapture(const Ca
546 mozilla::ipc::IPCResult CamerasParent::RecvStopCapture(
547 const CaptureEngine& aCapEngine, const int& capnum) {
548 - LOG((__PRETTY_FUNCTION__));
549 + LOG(("%s", __PRETTY_FUNCTION__));
551 RefPtr<CamerasParent> self(this);
552 RefPtr<Runnable> webrtc_runnable =
553 NewRunnableFrom([self, aCapEngine, capnum]() {
554 self->StopCapture(aCapEngine, capnum);
557 nsresult rv = DispatchToVideoCaptureThread(webrtc_runnable);
558 @@ -1010,29 +1010,29 @@ void CamerasParent::StopIPC() {
559 mShmemPool.Cleanup(this);
560 // We don't want to receive callbacks or anything if we can't
561 // forward them anymore anyway.
562 mChildIsAlive = false;
566 mozilla::ipc::IPCResult CamerasParent::RecvAllDone() {
567 - LOG((__PRETTY_FUNCTION__));
568 + LOG(("%s", __PRETTY_FUNCTION__));
569 // Don't try to send anything to the child now
570 mChildIsAlive = false;
571 IProtocol* mgr = Manager();
572 if (!Send__delete__(this)) {
573 return IPC_FAIL_NO_REASON(mgr);
578 void CamerasParent::ActorDestroy(ActorDestroyReason aWhy) {
579 // No more IPC from here
580 - LOG((__PRETTY_FUNCTION__));
581 + LOG(("%s", __PRETTY_FUNCTION__));
583 // Shut down WebRTC (if we're not in full shutdown, else this
584 // will already have happened)
588 nsString CamerasParent::GetNewName() {
589 static volatile uint64_t counter = 0;
590 diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp
591 --- a/dom/media/systemservices/MediaParent.cpp
592 +++ b/dom/media/systemservices/MediaParent.cpp
593 @@ -373,17 +373,17 @@ class OriginKeyStore : public nsISupport
595 nsCOMPtr<nsIFile> mProfileDir;
599 virtual ~OriginKeyStore() {
600 StaticMutexAutoLock lock(sOriginKeyStoreMutex);
601 sOriginKeyStore = nullptr;
602 - LOG((__FUNCTION__));
603 + LOG(("%s", __FUNCTION__));
607 static OriginKeyStore* Get() {
608 MOZ_ASSERT(NS_IsMainThread());
609 StaticMutexAutoLock lock(sOriginKeyStoreMutex);
610 if (!sOriginKeyStore) {
611 sOriginKeyStore = new OriginKeyStore();
612 @@ -504,17 +504,17 @@ mozilla::ipc::IPCResult Parent<Super>::R
617 template <class Super>
618 void Parent<Super>::ActorDestroy(ActorDestroyReason aWhy) {
619 // No more IPC from here
621 - LOG((__FUNCTION__));
622 + LOG(("%s", __FUNCTION__));
625 template <class Super>
626 Parent<Super>::Parent()
627 : mOriginKeyStore(OriginKeyStore::Get()), mDestroyed(false) {
628 LOG(("media::Parent: %p", this));
631 diff --git a/dom/media/systemservices/VideoEngine.cpp b/dom/media/systemservices/VideoEngine.cpp
632 --- a/dom/media/systemservices/VideoEngine.cpp
633 +++ b/dom/media/systemservices/VideoEngine.cpp
634 @@ -23,17 +23,17 @@ namespace camera {
636 mozilla::LazyLogModule gVideoEngineLog("VideoEngine");
637 #define LOG(args) MOZ_LOG(gVideoEngineLog, mozilla::LogLevel::Debug, args)
638 #define LOG_ENABLED() MOZ_LOG_TEST(gVideoEngineLog, mozilla::LogLevel::Debug)
640 int VideoEngine::sId = 0;
642 int VideoEngine::SetAndroidObjects() {
643 - LOG((__PRETTY_FUNCTION__));
644 + LOG(("%s", __PRETTY_FUNCTION__));
646 JavaVM* const javaVM = mozilla::jni::GetVM();
647 if (!javaVM || webrtc::SetCaptureAndroidVM(javaVM) != 0) {
648 LOG(("Could not set capture Android VM"));
651 # ifdef WEBRTC_INCLUDE_INTERNAL_VIDEO_RENDER
652 if (webrtc::SetRenderAndroidVM(javaVM) != 0) {
653 @@ -42,17 +42,17 @@ int VideoEngine::SetAndroidObjects() {
660 void VideoEngine::CreateVideoCapture(int32_t& id,
661 const char* deviceUniqueIdUTF8) {
662 - LOG((__PRETTY_FUNCTION__));
663 + LOG(("%s", __PRETTY_FUNCTION__));
664 MOZ_ASSERT(deviceUniqueIdUTF8);
667 LOG(("CaptureDeviceInfo.type=%s id=%d", mCaptureDevInfo.TypeName(), id));
669 for (auto& it : mCaps) {
670 if (it.second.VideoCapture() &&
671 it.second.VideoCapture()->CurrentDeviceName() &&
672 @@ -135,17 +135,17 @@ int VideoEngine::ReleaseVideoCapture(con
676 return found ? 0 : (-1);
679 std::shared_ptr<webrtc::VideoCaptureModule::DeviceInfo>
680 VideoEngine::GetOrCreateVideoCaptureDeviceInfo() {
681 - LOG((__PRETTY_FUNCTION__));
682 + LOG(("%s", __PRETTY_FUNCTION__));
683 int64_t currentTime = 0;
685 const char* capDevTypeName =
686 webrtc::CaptureDeviceInfo(mCaptureDevInfo.type).TypeName();
689 LOG(("Device cache available."));
690 // Camera cache is invalidated by HW change detection elsewhere
691 @@ -210,17 +210,17 @@ VideoEngine::GetOrCreateVideoCaptureDevi
694 const UniquePtr<const webrtc::Config>& VideoEngine::GetConfiguration() {
698 already_AddRefed<VideoEngine> VideoEngine::Create(
699 UniquePtr<const webrtc::Config>&& aConfig) {
700 - LOG((__PRETTY_FUNCTION__));
701 + LOG(("%s", __PRETTY_FUNCTION__));
702 LOG(("Creating new VideoEngine with CaptureDeviceType %s",
703 aConfig->Get<webrtc::CaptureDeviceInfo>().TypeName()));
704 return do_AddRef(new VideoEngine(std::move(aConfig)));
707 VideoEngine::CaptureEntry::CaptureEntry(
708 int32_t aCapnum, rtc::scoped_refptr<webrtc::VideoCaptureModule> aCapture)
709 : mCapnum(aCapnum), mVideoCaptureModule(aCapture) {}
710 @@ -258,13 +258,13 @@ int32_t VideoEngine::GenerateId() {
714 VideoEngine::VideoEngine(UniquePtr<const webrtc::Config>&& aConfig)
716 mCaptureDevInfo(aConfig->Get<webrtc::CaptureDeviceInfo>()),
717 mDeviceInfo(nullptr),
718 mConfig(std::move(aConfig)) {
719 - LOG((__PRETTY_FUNCTION__));
720 + LOG(("%s", __PRETTY_FUNCTION__));
723 } // namespace camera
724 } // namespace mozilla
725 diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
726 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
727 +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp
731 void MediaEngineRemoteVideoSource::Init() {
732 - LOG(__PRETTY_FUNCTION__);
733 + LOG("%s", __PRETTY_FUNCTION__);
734 AssertIsOnOwningThread();
736 char deviceName[kMaxDeviceNameLength];
740 void MediaEngineRemoteVideoSource::Shutdown() {
741 - LOG(__PRETTY_FUNCTION__);
742 + LOG("%s", __PRETTY_FUNCTION__);
743 AssertIsOnOwningThread();
749 void MediaEngineRemoteVideoSource::SetName(nsString aName) {
750 - LOG(__PRETTY_FUNCTION__);
751 + LOG("%s", __PRETTY_FUNCTION__);
752 AssertIsOnOwningThread();
754 mDeviceName = std::move(aName);
756 const nsString& aDeviceId,
757 const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
758 const char** aOutBadConstraint) {
759 - LOG(__PRETTY_FUNCTION__);
760 + LOG("%s", __PRETTY_FUNCTION__);
761 AssertIsOnOwningThread();
763 MOZ_ASSERT(mState == kReleased);
767 nsresult MediaEngineRemoteVideoSource::Deallocate() {
768 - LOG(__PRETTY_FUNCTION__);
769 + LOG("%s", __PRETTY_FUNCTION__);
770 AssertIsOnOwningThread();
772 MOZ_ASSERT(mState == kStopped || mState == kAllocated);
774 void MediaEngineRemoteVideoSource::SetTrack(
775 const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
776 const PrincipalHandle& aPrincipal) {
777 - LOG(__PRETTY_FUNCTION__);
778 + LOG("%s", __PRETTY_FUNCTION__);
779 AssertIsOnOwningThread();
781 MOZ_ASSERT(mState == kAllocated);
785 nsresult MediaEngineRemoteVideoSource::Start() {
786 - LOG(__PRETTY_FUNCTION__);
787 + LOG("%s", __PRETTY_FUNCTION__);
788 AssertIsOnOwningThread();
790 MOZ_ASSERT(mState == kAllocated || mState == kStopped);
794 nsresult MediaEngineRemoteVideoSource::FocusOnSelectedSource() {
795 - LOG(__PRETTY_FUNCTION__);
796 + LOG("%s", __PRETTY_FUNCTION__);
797 AssertIsOnOwningThread();
803 nsresult MediaEngineRemoteVideoSource::Stop() {
804 - LOG(__PRETTY_FUNCTION__);
805 + LOG("%s", __PRETTY_FUNCTION__);
806 AssertIsOnOwningThread();
808 if (mState == kStopped || mState == kAllocated) {
810 nsresult MediaEngineRemoteVideoSource::Reconfigure(
811 const MediaTrackConstraints& aConstraints, const MediaEnginePrefs& aPrefs,
812 const nsString& aDeviceId, const char** aOutBadConstraint) {
813 - LOG(__PRETTY_FUNCTION__);
814 + LOG("%s", __PRETTY_FUNCTION__);
815 AssertIsOnOwningThread();
817 MOZ_ASSERT(mInitDone);
819 const NormalizedConstraints& aConstraints, const MediaEnginePrefs& aPrefs,
820 const nsString& aDeviceId, webrtc::CaptureCapability& aCapability,
821 const DistanceCalculation aCalculate) {
822 - LOG(__PRETTY_FUNCTION__);
823 + LOG("%s", __PRETTY_FUNCTION__);
824 AssertIsOnOwningThread();
826 if (MOZ_LOG_TEST(gMediaManagerLog, LogLevel::Debug)) {
830 void MediaEngineRemoteVideoSource::Refresh(int aIndex) {
831 - LOG(__PRETTY_FUNCTION__);
832 + LOG("%s", __PRETTY_FUNCTION__);
833 AssertIsOnOwningThread();
835 // NOTE: mCaptureIndex might have changed when allocated!