Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1351)

Side by Side Diff: webrtc/media/base/videobroadcaster.cc

Issue 2328333002: New class AdaptedVideoTrackSource. (Closed)
Patch Set: Comment improvement. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/media/base/videobroadcaster.h ('k') | webrtc/media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 27 matching lines...) Expand all
38 VideoSourceBase::RemoveSink(sink); 38 VideoSourceBase::RemoveSink(sink);
39 UpdateWants(); 39 UpdateWants();
40 } 40 }
41 41
42 bool VideoBroadcaster::frame_wanted() const { 42 bool VideoBroadcaster::frame_wanted() const {
43 rtc::CritScope cs(&sinks_and_wants_lock_); 43 rtc::CritScope cs(&sinks_and_wants_lock_);
44 return !sink_pairs().empty(); 44 return !sink_pairs().empty();
45 } 45 }
46 46
47 VideoSinkWants VideoBroadcaster::wants() const { 47 VideoSinkWants VideoBroadcaster::wants() const {
48 RTC_DCHECK(thread_checker_.CalledOnValidThread());
49 rtc::CritScope cs(&sinks_and_wants_lock_); 48 rtc::CritScope cs(&sinks_and_wants_lock_);
50 return current_wants_; 49 return current_wants_;
51 } 50 }
52 51
53 void VideoBroadcaster::OnFrame(const cricket::VideoFrame& frame) { 52 void VideoBroadcaster::OnFrame(const cricket::VideoFrame& frame) {
54 rtc::CritScope cs(&sinks_and_wants_lock_); 53 rtc::CritScope cs(&sinks_and_wants_lock_);
55 for (auto& sink_pair : sink_pairs()) { 54 for (auto& sink_pair : sink_pairs()) {
55 if (sink_pair.wants.rotation_applied &&
56 frame.rotation() != webrtc::kVideoRotation_0) {
57 // 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 // with rotation still pending. Protect sinks that don't expect any
60 // pending rotation.
61 LOG(LS_VERBOSE) << "Discarding frame with unexpected rotation.";
62 continue;
63 }
56 if (sink_pair.wants.black_frames) { 64 if (sink_pair.wants.black_frames) {
57 sink_pair.sink->OnFrame(cricket::WebRtcVideoFrame( 65 sink_pair.sink->OnFrame(cricket::WebRtcVideoFrame(
58 GetBlackFrameBuffer(frame.width(), frame.height()), frame.rotation(), 66 GetBlackFrameBuffer(frame.width(), frame.height()), frame.rotation(),
59 frame.timestamp_us(), frame.transport_frame_id())); 67 frame.timestamp_us(), frame.transport_frame_id()));
60 } else { 68 } else {
61 sink_pair.sink->OnFrame(frame); 69 sink_pair.sink->OnFrame(frame);
62 } 70 }
63 } 71 }
64 } 72 }
65 73
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 rtc::scoped_refptr<webrtc::I420Buffer> buffer = 110 rtc::scoped_refptr<webrtc::I420Buffer> buffer =
103 new RefCountedObject<webrtc::I420Buffer>(width, height); 111 new RefCountedObject<webrtc::I420Buffer>(width, height);
104 buffer->SetToBlack(); 112 buffer->SetToBlack();
105 black_frame_buffer_ = buffer; 113 black_frame_buffer_ = buffer;
106 } 114 }
107 115
108 return black_frame_buffer_; 116 return black_frame_buffer_;
109 } 117 }
110 118
111 } // namespace rtc 119 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/media/base/videobroadcaster.h ('k') | webrtc/media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698