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

Side by Side Diff: media/cast/cast_sender_impl.cc

Issue 493823002: Implement adaptive target delay extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: explicit masking Created 6 years, 4 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 | « media/cast/cast_sender_impl.h ('k') | media/cast/net/cast_transport_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/cast_sender_impl.h" 5 #include "media/cast/cast_sender_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 audio_sender_.reset( 103 audio_sender_.reset(
104 new AudioSender(cast_environment_, audio_config, transport_sender_)); 104 new AudioSender(cast_environment_, audio_config, transport_sender_));
105 105
106 const CastInitializationStatus status = audio_sender_->InitializationResult(); 106 const CastInitializationStatus status = audio_sender_->InitializationResult();
107 if (status == STATUS_AUDIO_INITIALIZED) { 107 if (status == STATUS_AUDIO_INITIALIZED) {
108 ssrc_of_audio_sender_ = audio_config.incoming_feedback_ssrc; 108 ssrc_of_audio_sender_ = audio_config.incoming_feedback_ssrc;
109 audio_frame_input_ = 109 audio_frame_input_ =
110 new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr()); 110 new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr());
111 } 111 }
112 cast_initialization_cb.Run(status); 112 cast_initialization_cb.Run(status);
113 if (video_sender_) {
114 DCHECK(audio_sender_->GetTargetPlayoutDelay() ==
115 video_sender_->GetTargetPlayoutDelay());
116 }
113 } 117 }
114 118
115 void CastSenderImpl::InitializeVideo( 119 void CastSenderImpl::InitializeVideo(
116 const VideoSenderConfig& video_config, 120 const VideoSenderConfig& video_config,
117 const CastInitializationCallback& cast_initialization_cb, 121 const CastInitializationCallback& cast_initialization_cb,
118 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 122 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
119 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) { 123 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) {
120 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 124 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
121 CHECK(video_config.use_external_encoder || 125 CHECK(video_config.use_external_encoder ||
122 cast_environment_->HasVideoThread()); 126 cast_environment_->HasVideoThread());
123 127
124 VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()"; 128 VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()";
125 129
126 video_sender_.reset(new VideoSender(cast_environment_, 130 video_sender_.reset(new VideoSender(cast_environment_,
127 video_config, 131 video_config,
128 create_vea_cb, 132 create_vea_cb,
129 create_video_encode_mem_cb, 133 create_video_encode_mem_cb,
130 transport_sender_)); 134 transport_sender_));
131 135
132 const CastInitializationStatus status = video_sender_->InitializationResult(); 136 const CastInitializationStatus status = video_sender_->InitializationResult();
133 if (status == STATUS_VIDEO_INITIALIZED) { 137 if (status == STATUS_VIDEO_INITIALIZED) {
134 ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc; 138 ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc;
135 video_frame_input_ = 139 video_frame_input_ =
136 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); 140 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
137 } 141 }
138 cast_initialization_cb.Run(status); 142 cast_initialization_cb.Run(status);
143 if (audio_sender_) {
144 DCHECK(audio_sender_->GetTargetPlayoutDelay() ==
145 video_sender_->GetTargetPlayoutDelay());
146 }
139 } 147 }
140 148
141 CastSenderImpl::~CastSenderImpl() { 149 CastSenderImpl::~CastSenderImpl() {
142 VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()"; 150 VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()";
143 } 151 }
144 152
145 scoped_refptr<AudioFrameInput> CastSenderImpl::audio_frame_input() { 153 scoped_refptr<AudioFrameInput> CastSenderImpl::audio_frame_input() {
146 return audio_frame_input_; 154 return audio_frame_input_;
147 } 155 }
148 156
149 scoped_refptr<VideoFrameInput> CastSenderImpl::video_frame_input() { 157 scoped_refptr<VideoFrameInput> CastSenderImpl::video_frame_input() {
150 return video_frame_input_; 158 return video_frame_input_;
151 } 159 }
152 160
161 void CastSenderImpl::SetTargetPlayoutDelay(
162 base::TimeDelta new_target_playout_delay) {
163 VLOG(1) << "CastSenderImpl@" << this << "::SetTargetPlayoutDelay("
164 << new_target_playout_delay.InMilliseconds() << " ms)";
165 if (audio_sender_) {
166 audio_sender_->SetTargetPlayoutDelay(new_target_playout_delay);
167 }
168 if (video_sender_) {
169 video_sender_->SetTargetPlayoutDelay(new_target_playout_delay);
170 }
171 }
172
153 } // namespace cast 173 } // namespace cast
154 } // namespace media 174 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast_sender_impl.h ('k') | media/cast/net/cast_transport_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698