Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 RTC_DCHECK(async_invoker_); | 375 RTC_DCHECK(async_invoker_); |
| 376 if (start_thread_->IsCurrent()) { | 376 if (start_thread_->IsCurrent()) { |
| 377 SignalFrameCapturedOnStartThread(sample); | 377 SignalFrameCapturedOnStartThread(sample); |
| 378 } else { | 378 } else { |
| 379 // This currently happens on with at least VideoCaptureModuleV4L2 and | 379 // This currently happens on with at least VideoCaptureModuleV4L2 and |
| 380 // possibly other implementations of WebRTC's VideoCaptureModule. | 380 // possibly other implementations of WebRTC's VideoCaptureModule. |
| 381 // In order to maintain the threading contract with the upper layers and | 381 // In order to maintain the threading contract with the upper layers and |
| 382 // consistency with other capturers such as in Chrome, we need to do a | 382 // consistency with other capturers such as in Chrome, we need to do a |
| 383 // thread hop. | 383 // thread hop. |
| 384 // Note that Stop() can cause the async invoke call to be cancelled. | 384 // Note that Stop() can cause the async invoke call to be cancelled. |
| 385 async_invoker_->AsyncInvoke<void>(start_thread_, | 385 async_invoker_->AsyncInvoke<void>( |
| 386 // Note that this results in a shallow copying of the frame. | 386 start_thread_, |
|
noahric
2015/10/23 06:02:16
FYI, this is from git cl format.
| |
| 387 rtc::Bind(&WebRtcVideoCapturer::SignalFrameCapturedOnStartThread, | 387 // Note that Bind captures by value, so there's an intermediate copy |
| 388 this, sample)); | 388 // of sample. |
| 389 rtc::Bind(&WebRtcVideoCapturer::SignalFrameCapturedOnStartThread, this, | |
| 390 sample)); | |
| 389 } | 391 } |
| 390 } | 392 } |
| 391 | 393 |
| 392 void WebRtcVideoCapturer::OnCaptureDelayChanged(const int32_t id, | 394 void WebRtcVideoCapturer::OnCaptureDelayChanged(const int32_t id, |
| 393 const int32_t delay) { | 395 const int32_t delay) { |
| 394 LOG(LS_INFO) << "Capture delay changed to " << delay << " ms"; | 396 LOG(LS_INFO) << "Capture delay changed to " << delay << " ms"; |
| 395 } | 397 } |
| 396 | 398 |
| 397 void WebRtcVideoCapturer::SignalFrameCapturedOnStartThread( | 399 void WebRtcVideoCapturer::SignalFrameCapturedOnStartThread( |
| 398 const webrtc::VideoFrame frame) { | 400 const webrtc::VideoFrame& frame) { |
| 399 // This can only happen between Start() and Stop(). | 401 // This can only happen between Start() and Stop(). |
| 400 RTC_DCHECK(start_thread_); | 402 RTC_DCHECK(start_thread_); |
| 401 RTC_DCHECK(start_thread_->IsCurrent()); | 403 RTC_DCHECK(start_thread_->IsCurrent()); |
| 402 RTC_DCHECK(async_invoker_); | 404 RTC_DCHECK(async_invoker_); |
| 403 | 405 |
| 404 ++captured_frames_; | 406 ++captured_frames_; |
| 405 // Log the size and pixel aspect ratio of the first captured frame. | 407 // Log the size and pixel aspect ratio of the first captured frame. |
| 406 if (1 == captured_frames_) { | 408 if (1 == captured_frames_) { |
| 407 LOG(LS_INFO) << "Captured frame size " | 409 LOG(LS_INFO) << "Captured frame size " |
| 408 << frame.width() << "x" << frame.height() | 410 << frame.width() << "x" << frame.height() |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 435 // Convert units from VideoFrame RenderTimeMs to CapturedFrame (nanoseconds). | 437 // Convert units from VideoFrame RenderTimeMs to CapturedFrame (nanoseconds). |
| 436 time_stamp = sample.render_time_ms() * rtc::kNumNanosecsPerMillisec; | 438 time_stamp = sample.render_time_ms() * rtc::kNumNanosecsPerMillisec; |
| 437 data_size = rtc::checked_cast<uint32_t>(length); | 439 data_size = rtc::checked_cast<uint32_t>(length); |
| 438 data = buffer; | 440 data = buffer; |
| 439 rotation = sample.rotation(); | 441 rotation = sample.rotation(); |
| 440 } | 442 } |
| 441 | 443 |
| 442 } // namespace cricket | 444 } // namespace cricket |
| 443 | 445 |
| 444 #endif // HAVE_WEBRTC_VIDEO | 446 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |