]>
Commit | Line | Data |
---|---|---|
fa1bebab JP |
1 | |
2 | # HG changeset patch | |
3 | # User Mike Hommey <mh+mozilla@glandium.org> | |
4 | # Date 1566200940 0 | |
5 | # Node ID 42478b7856c0f10c862a1234e4e01040ee99deea | |
6 | # Parent 6eccfe79d02f025ada20d121eda69cf0b7921f16 | |
7 | Bug 1531309 - Don't use __PRETTY_FUNCTION__ or __FUNCTION__ as format strings. r=sylvestre | |
8 | ||
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. | |
12 | ||
13 | Differential Revision: https://phabricator.services.mozilla.com/D42459 | |
14 | ||
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 | |
19 | ||
20 | // So here we setup camera engine via EnsureInitialized(aCapEngine) | |
21 | ||
22 | EnsureInitialized(CameraEngine); | |
23 | return DeviceChangeCallback::AddDeviceChangeCallback(aCallback); | |
24 | } | |
25 | ||
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; | |
32 | monitor.Notify(); | |
33 | return IPC_OK(); | |
34 | } | |
35 | ||
36 | mozilla::ipc::IPCResult CamerasChild::RecvReplySuccess(void) { | |
37 | - LOG((__PRETTY_FUNCTION__)); | |
38 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
39 | MonitorAutoLock monitor(mReplyMonitor); | |
40 | mReceivedReply = true; | |
41 | mReplySuccess = true; | |
42 | monitor.Notify(); | |
43 | return IPC_OK(); | |
44 | } | |
45 | ||
46 | mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCapabilities( | |
47 | const int& numdev) { | |
48 | - LOG((__PRETTY_FUNCTION__)); | |
49 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
50 | MonitorAutoLock monitor(mReplyMonitor); | |
51 | mReceivedReply = true; | |
52 | mReplySuccess = true; | |
53 | mReplyInteger = numdev; | |
54 | monitor.Notify(); | |
55 | return IPC_OK(); | |
56 | } | |
57 | ||
58 | @@ -257,51 +257,51 @@ bool CamerasChild::DispatchToParent(nsIR | |
59 | if (!mReplySuccess) { | |
60 | return false; | |
61 | } | |
62 | return true; | |
63 | } | |
64 | ||
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(); | |
78 | } | |
79 | ||
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(); | |
89 | } | |
90 | ||
91 | mozilla::ipc::IPCResult CamerasChild::RecvReplyNumberOfCaptureDevices( | |
92 | const int& numdev) { | |
93 | - LOG((__PRETTY_FUNCTION__)); | |
94 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
95 | MonitorAutoLock monitor(mReplyMonitor); | |
96 | mReceivedReply = true; | |
97 | mReplySuccess = true; | |
98 | mReplyInteger = numdev; | |
99 | monitor.Notify(); | |
100 | return IPC_OK(); | |
101 | } | |
102 | ||
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(); | |
112 | } | |
113 | ||
114 | @@ -320,17 +320,17 @@ int CamerasChild::GetCaptureCapability( | |
115 | if (dispatcher.Success()) { | |
116 | capability = mReplyCapability; | |
117 | } | |
118 | return dispatcher.ReturnValue(); | |
119 | } | |
120 | ||
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 | |
134 | monitor.Notify(); | |
135 | return IPC_OK(); | |
136 | } | |
137 | ||
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)); | |
154 | } | |
155 | return dispatcher.ReturnValue(); | |
156 | } | |
157 | ||
158 | mozilla::ipc::IPCResult CamerasChild::RecvReplyGetCaptureDevice( | |
159 | const nsCString& device_name, const nsCString& device_id, | |
160 | const bool& scary) { | |
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; | |
168 | mReplyScary = scary; | |
169 | monitor.Notify(); | |
170 | return IPC_OK(); | |
171 | } | |
172 | ||
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, | |
185 | aPrincipalInfo); | |
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; | |
190 | } | |
191 | return dispatcher.ReturnValue(); | |
192 | } | |
193 | ||
194 | mozilla::ipc::IPCResult CamerasChild::RecvReplyAllocateCaptureDevice( | |
195 | const int& numdev) { | |
196 | - LOG((__PRETTY_FUNCTION__)); | |
197 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
198 | MonitorAutoLock monitor(mReplyMonitor); | |
199 | mReceivedReply = true; | |
200 | mReplySuccess = true; | |
201 | mReplyInteger = numdev; | |
202 | monitor.Notify(); | |
203 | return IPC_OK(); | |
204 | } | |
205 | ||
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(); | |
216 | } | |
217 | ||
218 | @@ -437,42 +437,42 @@ void CamerasChild::RemoveCallback(const | |
219 | break; | |
220 | } | |
221 | } | |
222 | } | |
223 | ||
224 | int CamerasChild::StartCapture(CaptureEngine aCapEngine, const int capture_id, | |
225 | webrtc::VideoCaptureCapability& webrtcCaps, | |
226 | FrameRelay* cb) { | |
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(); | |
239 | } | |
240 | ||
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(); | |
251 | } | |
252 | ||
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); | |
263 | } | |
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 | |
269 | // sends messages | |
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. | |
273 | ||
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__)); | |
278 | MOZ_ASSERT(mParent); | |
279 | ||
280 | RefPtr<InputObserver> self(this); | |
281 | RefPtr<nsIRunnable> ipc_runnable = NewRunnableFrom([self]() { | |
282 | if (self->mParent->IsShuttingDown()) { | |
283 | return NS_ERROR_FAILURE; | |
284 | } | |
285 | Unused << self->mParent->SendDeviceChange(); | |
286 | @@ -196,17 +196,17 @@ nsresult CamerasParent::DispatchToVideoC | |
287 | if (!sVideoCaptureThread || !sVideoCaptureThread->IsRunning()) { | |
288 | return NS_ERROR_FAILURE; | |
289 | } | |
290 | sVideoCaptureThread->message_loop()->PostTask(event.forget()); | |
291 | return NS_OK; | |
292 | } | |
293 | ||
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 | |
306 | return 0; | |
307 | } | |
308 | ||
309 | ShmemBuffer CamerasParent::GetBuffer(size_t aSize) { | |
310 | return mShmemPool.GetIfAvailable(aSize); | |
311 | } | |
312 | ||
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 | |
325 | ||
326 | mozilla::ipc::IPCResult CamerasParent::RecvReleaseFrame( | |
327 | mozilla::ipc::Shmem&& s) { | |
328 | mShmemPool.Put(ShmemBuffer(s)); | |
329 | return IPC_OK(); | |
330 | } | |
331 | ||
332 | bool CamerasParent::SetupEngine(CaptureEngine aCapEngine) { | |
333 | - LOG((__PRETTY_FUNCTION__)); | |
334 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
335 | StaticRefPtr<VideoEngine>& engine = sEngines[aCapEngine]; | |
336 | ||
337 | if (!engine) { | |
338 | UniquePtr<webrtc::CaptureDeviceInfo> captureDeviceInfo; | |
339 | auto config = MakeUnique<webrtc::Config>(); | |
340 | ||
341 | switch (aCapEngine) { | |
342 | case ScreenEngine: | |
343 | @@ -366,17 +366,17 @@ bool CamerasParent::SetupEngine(CaptureE | |
344 | device_info->RegisterVideoInputFeedBack(mCameraObserver); | |
345 | } | |
346 | } | |
347 | ||
348 | return true; | |
349 | } | |
350 | ||
351 | void CamerasParent::CloseEngines() { | |
352 | - LOG((__PRETTY_FUNCTION__)); | |
353 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
354 | if (!mWebRTCAlive) { | |
355 | return; | |
356 | } | |
357 | MOZ_ASSERT(sVideoCaptureThread->thread_id() == PlatformThread::CurrentId()); | |
358 | ||
359 | // Stop the callers | |
360 | while (mCallbacks.Length()) { | |
361 | auto capEngine = mCallbacks[0]->mCapEngine; | |
362 | @@ -406,17 +406,17 @@ void CamerasParent::CloseEngines() { | |
363 | } | |
364 | } | |
365 | } | |
366 | ||
367 | mWebRTCAlive = false; | |
368 | } | |
369 | ||
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. | |
374 | if (!mWebRTCAlive) { | |
375 | return nullptr; | |
376 | } | |
377 | CaptureEngine capEngine = static_cast<CaptureEngine>(aEngine); | |
378 | if (!SetupEngine(capEngine)) { | |
379 | LOG(("CamerasParent failed to initialize engine")); | |
380 | return nullptr; | |
381 | @@ -427,17 +427,17 @@ VideoEngine* CamerasParent::EnsureInitia | |
382 | ||
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]() { | |
395 | int num = -1; | |
396 | if (auto engine = self->EnsureInitialized(aCapEngine)) { | |
397 | if (auto devInfo = engine->GetOrCreateVideoCaptureDeviceInfo()) { | |
398 | num = devInfo->NumberOfDevices(); | |
399 | } | |
400 | @@ -461,17 +461,17 @@ mozilla::ipc::IPCResult CamerasParent::R | |
401 | return NS_OK; | |
402 | }); | |
403 | DispatchToVideoCaptureThread(webrtc_runnable); | |
404 | return IPC_OK(); | |
405 | } | |
406 | ||
407 | mozilla::ipc::IPCResult CamerasParent::RecvEnsureInitialized( | |
408 | const CaptureEngine& aCapEngine) { | |
409 | - LOG((__PRETTY_FUNCTION__)); | |
410 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
411 | ||
412 | RefPtr<CamerasParent> self(this); | |
413 | RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine]() { | |
414 | bool result = self->EnsureInitialized(aCapEngine); | |
415 | ||
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 | |
420 | return NS_OK; | |
421 | }); | |
422 | DispatchToVideoCaptureThread(webrtc_runnable); | |
423 | return IPC_OK(); | |
424 | } | |
425 | ||
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())); | |
431 | ||
432 | RefPtr<CamerasParent> self(this); | |
433 | RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, unique_id, | |
434 | aCapEngine]() { | |
435 | int num = -1; | |
436 | if (auto engine = self->EnsureInitialized(aCapEngine)) { | |
437 | if (auto devInfo = engine->GetOrCreateVideoCaptureDeviceInfo()) { | |
438 | @@ -528,17 +528,17 @@ mozilla::ipc::IPCResult CamerasParent::R | |
439 | }); | |
440 | DispatchToVideoCaptureThread(webrtc_runnable); | |
441 | return IPC_OK(); | |
442 | } | |
443 | ||
444 | mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureCapability( | |
445 | const CaptureEngine& aCapEngine, const nsCString& unique_id, | |
446 | const int& num) { | |
447 | - LOG((__PRETTY_FUNCTION__)); | |
448 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
449 | LOG(("RecvGetCaptureCapability: %s %d", unique_id.get(), num)); | |
450 | ||
451 | RefPtr<CamerasParent> self(this); | |
452 | RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, unique_id, | |
453 | aCapEngine, num]() { | |
454 | webrtc::VideoCaptureCapability webrtcCaps; | |
455 | int error = -1; | |
456 | if (auto engine = self->EnsureInitialized(aCapEngine)) { | |
457 | @@ -581,17 +581,17 @@ mozilla::ipc::IPCResult CamerasParent::R | |
458 | return NS_OK; | |
459 | }); | |
460 | DispatchToVideoCaptureThread(webrtc_runnable); | |
461 | return IPC_OK(); | |
462 | } | |
463 | ||
464 | mozilla::ipc::IPCResult CamerasParent::RecvGetCaptureDevice( | |
465 | const CaptureEngine& aCapEngine, const int& aListNumber) { | |
466 | - LOG((__PRETTY_FUNCTION__)); | |
467 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
468 | ||
469 | RefPtr<CamerasParent> self(this); | |
470 | RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine, | |
471 | aListNumber]() { | |
472 | char deviceName[MediaEngineSource::kMaxDeviceNameLength]; | |
473 | char deviceUniqueId[MediaEngineSource::kMaxUniqueIdLength]; | |
474 | nsCString name; | |
475 | nsCString uniqueId; | |
476 | @@ -751,17 +751,17 @@ int CamerasParent::ReleaseCaptureDevice( | |
477 | if (auto engine = EnsureInitialized(aCapEngine)) { | |
478 | error = engine->ReleaseVideoCapture(capnum); | |
479 | } | |
480 | return error; | |
481 | } | |
482 | ||
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)); | |
488 | ||
489 | RefPtr<CamerasParent> self(this); | |
490 | RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine, | |
491 | numdev]() { | |
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 | |
496 | }); | |
497 | DispatchToVideoCaptureThread(webrtc_runnable); | |
498 | return IPC_OK(); | |
499 | } | |
500 | ||
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__)); | |
506 | ||
507 | RefPtr<CamerasParent> self(this); | |
508 | RefPtr<Runnable> webrtc_runnable = NewRunnableFrom([self, aCapEngine, capnum, | |
509 | ipcCaps]() { | |
510 | - LOG((__PRETTY_FUNCTION__)); | |
511 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
512 | CallbackHelper** cbh; | |
513 | int error = -1; | |
514 | if (self->EnsureInitialized(aCapEngine)) { | |
515 | cbh = self->mCallbacks.AppendElement(new CallbackHelper( | |
516 | static_cast<CaptureEngine>(aCapEngine), capnum, self)); | |
517 | ||
518 | self->sEngines[aCapEngine]->WithEntry( | |
519 | capnum, [&capnum, &aCapEngine, &error, &ipcCaps, &cbh, | |
520 | @@ -910,17 +910,17 @@ mozilla::ipc::IPCResult CamerasParent::R | |
521 | return NS_OK; | |
522 | }); | |
523 | DispatchToVideoCaptureThread(webrtc_runnable); | |
524 | return IPC_OK(); | |
525 | } | |
526 | ||
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 | |
540 | break; | |
541 | } | |
542 | } | |
543 | } | |
544 | } | |
545 | ||
546 | mozilla::ipc::IPCResult CamerasParent::RecvStopCapture( | |
547 | const CaptureEngine& aCapEngine, const int& capnum) { | |
548 | - LOG((__PRETTY_FUNCTION__)); | |
549 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
550 | ||
551 | RefPtr<CamerasParent> self(this); | |
552 | RefPtr<Runnable> webrtc_runnable = | |
553 | NewRunnableFrom([self, aCapEngine, capnum]() { | |
554 | self->StopCapture(aCapEngine, capnum); | |
555 | return NS_OK; | |
556 | }); | |
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; | |
563 | mDestroyed = true; | |
564 | } | |
565 | ||
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); | |
574 | } | |
575 | return IPC_OK(); | |
576 | } | |
577 | ||
578 | void CamerasParent::ActorDestroy(ActorDestroyReason aWhy) { | |
579 | // No more IPC from here | |
580 | - LOG((__PRETTY_FUNCTION__)); | |
581 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
582 | StopIPC(); | |
583 | // Shut down WebRTC (if we're not in full shutdown, else this | |
584 | // will already have happened) | |
585 | StopVideoCapture(); | |
586 | } | |
587 | ||
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 | |
594 | private: | |
595 | nsCOMPtr<nsIFile> mProfileDir; | |
596 | }; | |
597 | ||
598 | private: | |
599 | virtual ~OriginKeyStore() { | |
600 | StaticMutexAutoLock lock(sOriginKeyStoreMutex); | |
601 | sOriginKeyStore = nullptr; | |
602 | - LOG((__FUNCTION__)); | |
603 | + LOG(("%s", __FUNCTION__)); | |
604 | } | |
605 | ||
606 | public: | |
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 | |
613 | } | |
614 | return IPC_OK(); | |
615 | } | |
616 | ||
617 | template <class Super> | |
618 | void Parent<Super>::ActorDestroy(ActorDestroyReason aWhy) { | |
619 | // No more IPC from here | |
620 | mDestroyed = true; | |
621 | - LOG((__FUNCTION__)); | |
622 | + LOG(("%s", __FUNCTION__)); | |
623 | } | |
624 | ||
625 | template <class Super> | |
626 | Parent<Super>::Parent() | |
627 | : mOriginKeyStore(OriginKeyStore::Get()), mDestroyed(false) { | |
628 | LOG(("media::Parent: %p", this)); | |
629 | } | |
630 | ||
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 { | |
635 | #undef LOG_ENABLED | |
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) | |
639 | ||
640 | int VideoEngine::sId = 0; | |
641 | #if defined(ANDROID) | |
642 | int VideoEngine::SetAndroidObjects() { | |
643 | - LOG((__PRETTY_FUNCTION__)); | |
644 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
645 | ||
646 | JavaVM* const javaVM = mozilla::jni::GetVM(); | |
647 | if (!javaVM || webrtc::SetCaptureAndroidVM(javaVM) != 0) { | |
648 | LOG(("Could not set capture Android VM")); | |
649 | return -1; | |
650 | } | |
651 | # ifdef WEBRTC_INCLUDE_INTERNAL_VIDEO_RENDER | |
652 | if (webrtc::SetRenderAndroidVM(javaVM) != 0) { | |
653 | @@ -42,17 +42,17 @@ int VideoEngine::SetAndroidObjects() { | |
654 | } | |
655 | # endif | |
656 | return 0; | |
657 | } | |
658 | #endif | |
659 | ||
660 | void VideoEngine::CreateVideoCapture(int32_t& id, | |
661 | const char* deviceUniqueIdUTF8) { | |
662 | - LOG((__PRETTY_FUNCTION__)); | |
663 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
664 | MOZ_ASSERT(deviceUniqueIdUTF8); | |
665 | ||
666 | id = GenerateId(); | |
667 | LOG(("CaptureDeviceInfo.type=%s id=%d", mCaptureDevInfo.TypeName(), id)); | |
668 | ||
669 | for (auto& it : mCaps) { | |
670 | if (it.second.VideoCapture() && | |
671 | it.second.VideoCapture()->CurrentDeviceName() && | |
672 | @@ -135,17 +135,17 @@ int VideoEngine::ReleaseVideoCapture(con | |
673 | } | |
674 | ||
675 | mIdMap.erase(id); | |
676 | return found ? 0 : (-1); | |
677 | } | |
678 | ||
679 | std::shared_ptr<webrtc::VideoCaptureModule::DeviceInfo> | |
680 | VideoEngine::GetOrCreateVideoCaptureDeviceInfo() { | |
681 | - LOG((__PRETTY_FUNCTION__)); | |
682 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
683 | int64_t currentTime = 0; | |
684 | ||
685 | const char* capDevTypeName = | |
686 | webrtc::CaptureDeviceInfo(mCaptureDevInfo.type).TypeName(); | |
687 | ||
688 | if (mDeviceInfo) { | |
689 | LOG(("Device cache available.")); | |
690 | // Camera cache is invalidated by HW change detection elsewhere | |
691 | @@ -210,17 +210,17 @@ VideoEngine::GetOrCreateVideoCaptureDevi | |
692 | } | |
693 | ||
694 | const UniquePtr<const webrtc::Config>& VideoEngine::GetConfiguration() { | |
695 | return mConfig; | |
696 | } | |
697 | ||
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))); | |
705 | } | |
706 | ||
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() { | |
711 | return mId = sId++; | |
712 | } | |
713 | ||
714 | VideoEngine::VideoEngine(UniquePtr<const webrtc::Config>&& aConfig) | |
715 | : mId(0), | |
716 | mCaptureDevInfo(aConfig->Get<webrtc::CaptureDeviceInfo>()), | |
717 | mDeviceInfo(nullptr), | |
718 | mConfig(std::move(aConfig)) { | |
719 | - LOG((__PRETTY_FUNCTION__)); | |
720 | + LOG(("%s", __PRETTY_FUNCTION__)); | |
721 | } | |
722 | ||
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 | |
728 | @@ -68,7 +68,7 @@ | |
729 | } | |
730 | ||
731 | void MediaEngineRemoteVideoSource::Init() { | |
732 | - LOG(__PRETTY_FUNCTION__); | |
733 | + LOG("%s", __PRETTY_FUNCTION__); | |
734 | AssertIsOnOwningThread(); | |
735 | ||
736 | char deviceName[kMaxDeviceNameLength]; | |
737 | @@ -89,7 +89,7 @@ | |
738 | } | |
739 | ||
740 | void MediaEngineRemoteVideoSource::Shutdown() { | |
741 | - LOG(__PRETTY_FUNCTION__); | |
742 | + LOG("%s", __PRETTY_FUNCTION__); | |
743 | AssertIsOnOwningThread(); | |
744 | ||
745 | if (!mInitDone) { | |
746 | @@ -109,7 +109,7 @@ | |
747 | } | |
748 | ||
749 | void MediaEngineRemoteVideoSource::SetName(nsString aName) { | |
750 | - LOG(__PRETTY_FUNCTION__); | |
751 | + LOG("%s", __PRETTY_FUNCTION__); | |
752 | AssertIsOnOwningThread(); | |
753 | ||
754 | mDeviceName = std::move(aName); | |
755 | @@ -193,7 +193,7 @@ | |
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(); | |
762 | ||
763 | MOZ_ASSERT(mState == kReleased); | |
764 | @@ -231,7 +231,7 @@ | |
765 | } | |
766 | ||
767 | nsresult MediaEngineRemoteVideoSource::Deallocate() { | |
768 | - LOG(__PRETTY_FUNCTION__); | |
769 | + LOG("%s", __PRETTY_FUNCTION__); | |
770 | AssertIsOnOwningThread(); | |
771 | ||
772 | MOZ_ASSERT(mState == kStopped || mState == kAllocated); | |
773 | @@ -267,7 +267,7 @@ | |
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(); | |
780 | ||
781 | MOZ_ASSERT(mState == kAllocated); | |
782 | @@ -292,7 +292,7 @@ | |
783 | } | |
784 | ||
785 | nsresult MediaEngineRemoteVideoSource::Start() { | |
786 | - LOG(__PRETTY_FUNCTION__); | |
787 | + LOG("%s", __PRETTY_FUNCTION__); | |
788 | AssertIsOnOwningThread(); | |
789 | ||
790 | MOZ_ASSERT(mState == kAllocated || mState == kStopped); | |
791 | @@ -345,7 +345,7 @@ | |
792 | } | |
793 | ||
794 | nsresult MediaEngineRemoteVideoSource::FocusOnSelectedSource() { | |
795 | - LOG(__PRETTY_FUNCTION__); | |
796 | + LOG("%s", __PRETTY_FUNCTION__); | |
797 | AssertIsOnOwningThread(); | |
798 | ||
799 | int result; | |
800 | @@ -355,7 +355,7 @@ | |
801 | } | |
802 | ||
803 | nsresult MediaEngineRemoteVideoSource::Stop() { | |
804 | - LOG(__PRETTY_FUNCTION__); | |
805 | + LOG("%s", __PRETTY_FUNCTION__); | |
806 | AssertIsOnOwningThread(); | |
807 | ||
808 | if (mState == kStopped || mState == kAllocated) { | |
809 | @@ -381,7 +381,7 @@ | |
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(); | |
816 | ||
817 | MOZ_ASSERT(mInitDone); | |
818 | @@ -762,7 +762,7 @@ | |
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(); | |
825 | ||
826 | if (MOZ_LOG_TEST(gMediaManagerLog, LogLevel::Debug)) { | |
827 | @@ -928,7 +928,7 @@ | |
828 | } | |
829 | ||
830 | void MediaEngineRemoteVideoSource::Refresh(int aIndex) { | |
831 | - LOG(__PRETTY_FUNCTION__); | |
832 | + LOG("%s", __PRETTY_FUNCTION__); | |
833 | AssertIsOnOwningThread(); | |
834 | ||
835 | // NOTE: mCaptureIndex might have changed when allocated! |