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

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

Issue 555563003: Cast: Flow hw encoder initialization error to extensions API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed compile Created 6 years, 3 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/rtp/framer.cc » ('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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 CHECK(audio_config.use_external_encoder || 98 CHECK(audio_config.use_external_encoder ||
99 cast_environment_->HasAudioThread()); 99 cast_environment_->HasAudioThread());
100 100
101 VLOG(1) << "CastSenderImpl@" << this << "::InitializeAudio()"; 101 VLOG(1) << "CastSenderImpl@" << this << "::InitializeAudio()";
102 102
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;
109 audio_frame_input_ = 108 audio_frame_input_ =
110 new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr()); 109 new LocalAudioFrameInput(cast_environment_, audio_sender_->AsWeakPtr());
111 } 110 }
112 cast_initialization_cb.Run(status); 111 cast_initialization_cb.Run(status);
113 if (video_sender_) { 112 if (video_sender_) {
114 DCHECK(audio_sender_->GetTargetPlayoutDelay() == 113 DCHECK(audio_sender_->GetTargetPlayoutDelay() ==
115 video_sender_->GetTargetPlayoutDelay()); 114 video_sender_->GetTargetPlayoutDelay());
116 } 115 }
117 } 116 }
118 117
119 void CastSenderImpl::InitializeVideo( 118 void CastSenderImpl::InitializeVideo(
120 const VideoSenderConfig& video_config, 119 const VideoSenderConfig& video_config,
121 const CastInitializationCallback& cast_initialization_cb, 120 const CastInitializationCallback& cast_initialization_cb,
122 const CreateVideoEncodeAcceleratorCallback& create_vea_cb, 121 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
123 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) { 122 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb) {
124 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 123 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
125 CHECK(video_config.use_external_encoder || 124 CHECK(video_config.use_external_encoder ||
126 cast_environment_->HasVideoThread()); 125 cast_environment_->HasVideoThread());
127 126
128 VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()"; 127 VLOG(1) << "CastSenderImpl@" << this << "::InitializeVideo()";
129 128
130 video_sender_.reset(new VideoSender(cast_environment_, 129 video_sender_.reset(new VideoSender(
131 video_config, 130 cast_environment_,
132 create_vea_cb, 131 video_config,
133 create_video_encode_mem_cb, 132 base::Bind(&CastSenderImpl::OnVideoInitialized,
134 transport_sender_)); 133 weak_factory_.GetWeakPtr(), cast_initialization_cb),
135 134 create_vea_cb,
136 const CastInitializationStatus status = video_sender_->InitializationResult(); 135 create_video_encode_mem_cb,
137 if (status == STATUS_VIDEO_INITIALIZED) { 136 transport_sender_));
138 ssrc_of_video_sender_ = video_config.incoming_feedback_ssrc;
139 video_frame_input_ =
140 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
141 }
142 cast_initialization_cb.Run(status);
143 if (audio_sender_) { 137 if (audio_sender_) {
144 DCHECK(audio_sender_->GetTargetPlayoutDelay() == 138 DCHECK(audio_sender_->GetTargetPlayoutDelay() ==
145 video_sender_->GetTargetPlayoutDelay()); 139 video_sender_->GetTargetPlayoutDelay());
146 } 140 }
147 } 141 }
148 142
149 CastSenderImpl::~CastSenderImpl() { 143 CastSenderImpl::~CastSenderImpl() {
150 VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()"; 144 VLOG(1) << "CastSenderImpl@" << this << "::~CastSenderImpl()";
151 } 145 }
152 146
(...skipping 10 matching lines...) Expand all
163 VLOG(1) << "CastSenderImpl@" << this << "::SetTargetPlayoutDelay(" 157 VLOG(1) << "CastSenderImpl@" << this << "::SetTargetPlayoutDelay("
164 << new_target_playout_delay.InMilliseconds() << " ms)"; 158 << new_target_playout_delay.InMilliseconds() << " ms)";
165 if (audio_sender_) { 159 if (audio_sender_) {
166 audio_sender_->SetTargetPlayoutDelay(new_target_playout_delay); 160 audio_sender_->SetTargetPlayoutDelay(new_target_playout_delay);
167 } 161 }
168 if (video_sender_) { 162 if (video_sender_) {
169 video_sender_->SetTargetPlayoutDelay(new_target_playout_delay); 163 video_sender_->SetTargetPlayoutDelay(new_target_playout_delay);
170 } 164 }
171 } 165 }
172 166
167 void CastSenderImpl::OnVideoInitialized(
168 const CastInitializationCallback& initialization_cb,
169 media::cast::CastInitializationStatus result) {
170 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
171 video_frame_input_ =
172 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
173 initialization_cb.Run(result);
174 }
175
173 } // namespace cast 176 } // namespace cast
174 } // namespace media 177 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast_sender_impl.h ('k') | media/cast/net/rtp/framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698