| 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" | |
| 17 | 16 |
| 18 namespace rtc { | 17 namespace rtc { |
| 19 | 18 |
| 20 VideoBroadcaster::VideoBroadcaster() { | 19 VideoBroadcaster::VideoBroadcaster() { |
| 21 thread_checker_.DetachFromThread(); | 20 thread_checker_.DetachFromThread(); |
| 22 } | 21 } |
| 23 | 22 |
| 24 void VideoBroadcaster::AddOrUpdateSink( | 23 void VideoBroadcaster::AddOrUpdateSink( |
| 25 VideoSinkInterface<cricket::VideoFrame>* sink, | 24 VideoSinkInterface<cricket::VideoFrame>* sink, |
| 26 const VideoSinkWants& wants) { | 25 const VideoSinkWants& wants) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // Calls to OnFrame are not synchronized with changes to the sink wants. | 57 // Calls to OnFrame are not synchronized with changes to the sink wants. |
| 59 // When rotation_applied is set to true, one or a few frames may get here | 58 // When rotation_applied is set to true, one or a few frames may get here |
| 60 // with rotation still pending. Protect sinks that don't expect any | 59 // with rotation still pending. Protect sinks that don't expect any |
| 61 // pending rotation. | 60 // pending rotation. |
| 62 LOG(LS_VERBOSE) << "Discarding frame with unexpected rotation."; | 61 LOG(LS_VERBOSE) << "Discarding frame with unexpected rotation."; |
| 63 continue; | 62 continue; |
| 64 } | 63 } |
| 65 if (sink_pair.wants.black_frames) { | 64 if (sink_pair.wants.black_frames) { |
| 66 sink_pair.sink->OnFrame(cricket::WebRtcVideoFrame( | 65 sink_pair.sink->OnFrame(cricket::WebRtcVideoFrame( |
| 67 GetBlackFrameBuffer(frame.width(), frame.height()), frame.rotation(), | 66 GetBlackFrameBuffer(frame.width(), frame.height()), frame.rotation(), |
| 68 frame.timestamp_us())); | 67 frame.timestamp_us(), frame.transport_frame_id())); |
| 69 } else { | 68 } else { |
| 70 sink_pair.sink->OnFrame(frame); | 69 sink_pair.sink->OnFrame(frame); |
| 71 } | 70 } |
| 72 } | 71 } |
| 73 } | 72 } |
| 74 | 73 |
| 75 void VideoBroadcaster::UpdateWants() { | 74 void VideoBroadcaster::UpdateWants() { |
| 76 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 75 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 77 | 76 |
| 78 VideoSinkWants wants; | 77 VideoSinkWants wants; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | 110 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
| 112 new RefCountedObject<webrtc::I420Buffer>(width, height); | 111 new RefCountedObject<webrtc::I420Buffer>(width, height); |
| 113 buffer->SetToBlack(); | 112 buffer->SetToBlack(); |
| 114 black_frame_buffer_ = buffer; | 113 black_frame_buffer_ = buffer; |
| 115 } | 114 } |
| 116 | 115 |
| 117 return black_frame_buffer_; | 116 return black_frame_buffer_; |
| 118 } | 117 } |
| 119 | 118 |
| 120 } // namespace rtc | 119 } // namespace rtc |
| OLD | NEW |