| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/media/base/videobroadcaster.h" | 11 #include "webrtc/media/base/videobroadcaster.h" |
| 12 | 12 |
| 13 #include <limits> | 13 #include <limits> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/base/logging.h" |
| 16 | 17 |
| 17 namespace rtc { | 18 namespace rtc { |
| 18 | 19 |
| 19 VideoBroadcaster::VideoBroadcaster() { | 20 VideoBroadcaster::VideoBroadcaster() { |
| 20 thread_checker_.DetachFromThread(); | 21 thread_checker_.DetachFromThread(); |
| 21 } | 22 } |
| 22 | 23 |
| 23 void VideoBroadcaster::AddOrUpdateSink( | 24 void VideoBroadcaster::AddOrUpdateSink( |
| 24 VideoSinkInterface<cricket::VideoFrame>* sink, | 25 VideoSinkInterface<cricket::VideoFrame>* sink, |
| 25 const VideoSinkWants& wants) { | 26 const VideoSinkWants& wants) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Calls to OnFrame are not synchronized with changes to the sink wants. | 58 // Calls to OnFrame are not synchronized with changes to the sink wants. |
| 58 // When rotation_applied is set to true, one or a few frames may get here | 59 // When rotation_applied is set to true, one or a few frames may get here |
| 59 // with rotation still pending. Protect sinks that don't expect any | 60 // with rotation still pending. Protect sinks that don't expect any |
| 60 // pending rotation. | 61 // pending rotation. |
| 61 LOG(LS_VERBOSE) << "Discarding frame with unexpected rotation."; | 62 LOG(LS_VERBOSE) << "Discarding frame with unexpected rotation."; |
| 62 continue; | 63 continue; |
| 63 } | 64 } |
| 64 if (sink_pair.wants.black_frames) { | 65 if (sink_pair.wants.black_frames) { |
| 65 sink_pair.sink->OnFrame(cricket::WebRtcVideoFrame( | 66 sink_pair.sink->OnFrame(cricket::WebRtcVideoFrame( |
| 66 GetBlackFrameBuffer(frame.width(), frame.height()), frame.rotation(), | 67 GetBlackFrameBuffer(frame.width(), frame.height()), frame.rotation(), |
| 67 frame.timestamp_us(), frame.transport_frame_id())); | 68 frame.timestamp_us())); |
| 68 } else { | 69 } else { |
| 69 sink_pair.sink->OnFrame(frame); | 70 sink_pair.sink->OnFrame(frame); |
| 70 } | 71 } |
| 71 } | 72 } |
| 72 } | 73 } |
| 73 | 74 |
| 74 void VideoBroadcaster::UpdateWants() { | 75 void VideoBroadcaster::UpdateWants() { |
| 75 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 76 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 76 | 77 |
| 77 VideoSinkWants wants; | 78 VideoSinkWants wants; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | 111 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
| 111 new RefCountedObject<webrtc::I420Buffer>(width, height); | 112 new RefCountedObject<webrtc::I420Buffer>(width, height); |
| 112 buffer->SetToBlack(); | 113 buffer->SetToBlack(); |
| 113 black_frame_buffer_ = buffer; | 114 black_frame_buffer_ = buffer; |
| 114 } | 115 } |
| 115 | 116 |
| 116 return black_frame_buffer_; | 117 return black_frame_buffer_; |
| 117 } | 118 } |
| 118 | 119 |
| 119 } // namespace rtc | 120 } // namespace rtc |
| OLD | NEW |