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

Side by Side Diff: media/base/android/media_source_player.cc

Issue 23787002: Rename MediaPlayerHostMsg_{DemuxerReady,ReadFromDemuxerAck}_Params to Media{Configs,Data}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/base/android/media_source_player.h" 5 #include "media/base/android/media_source_player.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/barrier_closure.h" 9 #include "base/barrier_closure.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 (HasVideo() && !video_decoder_job_)) { 200 (HasVideo() && !video_decoder_job_)) {
201 return; 201 return;
202 } 202 }
203 203
204 audio_finished_ = false; 204 audio_finished_ = false;
205 video_finished_ = false; 205 video_finished_ = false;
206 SetPendingEvent(PREFETCH_REQUEST_EVENT_PENDING); 206 SetPendingEvent(PREFETCH_REQUEST_EVENT_PENDING);
207 ProcessPendingEvents(); 207 ProcessPendingEvents();
208 } 208 }
209 209
210 void MediaSourcePlayer::DemuxerReady( 210 void MediaSourcePlayer::DemuxerReady(const DemuxerConfigs& configs) {
211 const MediaPlayerHostMsg_DemuxerReady_Params& params) {
212 DVLOG(1) << __FUNCTION__; 211 DVLOG(1) << __FUNCTION__;
213 duration_ = base::TimeDelta::FromMilliseconds(params.duration_ms); 212 duration_ = base::TimeDelta::FromMilliseconds(configs.duration_ms);
214 clock_.SetDuration(duration_); 213 clock_.SetDuration(duration_);
215 214
216 audio_codec_ = params.audio_codec; 215 audio_codec_ = configs.audio_codec;
217 num_channels_ = params.audio_channels; 216 num_channels_ = configs.audio_channels;
218 sampling_rate_ = params.audio_sampling_rate; 217 sampling_rate_ = configs.audio_sampling_rate;
219 is_audio_encrypted_ = params.is_audio_encrypted; 218 is_audio_encrypted_ = configs.is_audio_encrypted;
220 audio_extra_data_ = params.audio_extra_data; 219 audio_extra_data_ = configs.audio_extra_data;
221 if (HasAudio()) { 220 if (HasAudio()) {
222 DCHECK_GT(num_channels_, 0); 221 DCHECK_GT(num_channels_, 0);
223 audio_timestamp_helper_.reset(new AudioTimestampHelper(sampling_rate_)); 222 audio_timestamp_helper_.reset(new AudioTimestampHelper(sampling_rate_));
224 audio_timestamp_helper_->SetBaseTimestamp(GetCurrentTime()); 223 audio_timestamp_helper_->SetBaseTimestamp(GetCurrentTime());
225 } else { 224 } else {
226 audio_timestamp_helper_.reset(); 225 audio_timestamp_helper_.reset();
227 } 226 }
228 227
229 video_codec_ = params.video_codec; 228 video_codec_ = configs.video_codec;
230 width_ = params.video_size.width(); 229 width_ = configs.video_size.width();
231 height_ = params.video_size.height(); 230 height_ = configs.video_size.height();
232 is_video_encrypted_ = params.is_video_encrypted; 231 is_video_encrypted_ = configs.is_video_encrypted;
233 232
234 OnMediaMetadataChanged(duration_, width_, height_, true); 233 OnMediaMetadataChanged(duration_, width_, height_, true);
235 234
236 if (IsEventPending(CONFIG_CHANGE_EVENT_PENDING)) { 235 if (IsEventPending(CONFIG_CHANGE_EVENT_PENDING)) {
237 if (reconfig_audio_decoder_) 236 if (reconfig_audio_decoder_)
238 ConfigureAudioDecoderJob(); 237 ConfigureAudioDecoderJob();
239 238
240 // If there is a pending surface change, we can merge it with the config 239 // If there is a pending surface change, we can merge it with the config
241 // change. 240 // change.
242 if (reconfig_video_decoder_) { 241 if (reconfig_video_decoder_) {
243 if (IsEventPending(SURFACE_CHANGE_EVENT_PENDING)) 242 if (IsEventPending(SURFACE_CHANGE_EVENT_PENDING))
244 ClearPendingEvent(SURFACE_CHANGE_EVENT_PENDING); 243 ClearPendingEvent(SURFACE_CHANGE_EVENT_PENDING);
245 ConfigureVideoDecoderJob(); 244 ConfigureVideoDecoderJob();
246 } 245 }
247 246
248 ClearPendingEvent(CONFIG_CHANGE_EVENT_PENDING); 247 ClearPendingEvent(CONFIG_CHANGE_EVENT_PENDING);
249 248
250 // Resume decoding after the config change if we are still playing. 249 // Resume decoding after the config change if we are still playing.
251 if (playing_) 250 if (playing_)
252 StartInternal(); 251 StartInternal();
253 } 252 }
254 } 253 }
255 254
256 void MediaSourcePlayer::ReadFromDemuxerAck( 255 void MediaSourcePlayer::ReadFromDemuxerAck(const DemuxerData& data) {
257 const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) { 256 DVLOG(1) << __FUNCTION__ << "(" << data.type << ")";
258 DVLOG(1) << __FUNCTION__ << "(" << params.type << ")"; 257 DCHECK_LT(0u, data.access_units.size());
259 DCHECK_LT(0u, params.access_units.size()); 258 if (data.type == DemuxerStream::AUDIO)
260 if (params.type == DemuxerStream::AUDIO) 259 audio_decoder_job_->OnDataReceived(data);
261 audio_decoder_job_->OnDataReceived(params);
262 else 260 else
263 video_decoder_job_->OnDataReceived(params); 261 video_decoder_job_->OnDataReceived(data);
264 } 262 }
265 263
266 void MediaSourcePlayer::DurationChanged(const base::TimeDelta& duration) { 264 void MediaSourcePlayer::DurationChanged(const base::TimeDelta& duration) {
267 duration_ = duration; 265 duration_ = duration;
268 clock_.SetDuration(duration_); 266 clock_.SetDuration(duration_);
269 } 267 }
270 268
271 void MediaSourcePlayer::SetDrmBridge(MediaDrmBridge* drm_bridge) { 269 void MediaSourcePlayer::SetDrmBridge(MediaDrmBridge* drm_bridge) {
272 // Currently we don't support DRM change during the middle of playback, even 270 // Currently we don't support DRM change during the middle of playback, even
273 // if the player is paused. 271 // if the player is paused.
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 662
665 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { 663 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) {
666 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; 664 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")";
667 DCHECK_NE(event, NO_EVENT_PENDING); 665 DCHECK_NE(event, NO_EVENT_PENDING);
668 DCHECK(IsEventPending(event)); 666 DCHECK(IsEventPending(event));
669 667
670 pending_event_ &= ~event; 668 pending_event_ &= ~event;
671 } 669 }
672 670
673 } // namespace media 671 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_source_player.h ('k') | media/base/android/media_source_player_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698