Index: media/base/android/media_decoder_job.cc |
diff --git a/media/base/android/media_decoder_job.cc b/media/base/android/media_decoder_job.cc |
index c57da3af1729fe0df9ba72e8613742dd38d97f68..cecbbeec5b35953ba33b6f6ea859734f3f86757b 100644 |
--- a/media/base/android/media_decoder_job.cc |
+++ b/media/base/android/media_decoder_job.cc |
@@ -19,6 +19,18 @@ namespace media { |
// here. See http://b/9357571. |
static const int kMediaCodecTimeoutInMilliseconds = 250; |
+static void CopyDemuxerConfig(DemuxerConfigs* src, DemuxerConfigs* dest) { |
+ dest->audio_codec = src->audio_codec; |
+ dest->audio_channels = src->audio_channels; |
+ dest->audio_sampling_rate = src->audio_sampling_rate; |
+ dest->is_audio_encrypted = src->is_audio_encrypted; |
+ dest->audio_extra_data = src->audio_extra_data; |
+ dest->video_codec = src->video_codec; |
+ dest->video_size = src->video_size; |
+ dest->is_video_encrypted = src->is_video_encrypted; |
+ dest->video_extra_data = src->video_extra_data; |
+} |
+ |
MediaDecoderJob::MediaDecoderJob( |
const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner, |
MediaCodecBridge* media_codec_bridge, |
@@ -102,7 +114,7 @@ void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) { |
RequestData(prefetch_cb); |
} |
-bool MediaDecoderJob::Decode( |
+DemuxerConfigs* MediaDecoderJob::Decode( |
base::TimeTicks start_time_ticks, |
base::TimeDelta start_presentation_timestamp, |
const DecoderCallback& callback) { |
@@ -117,18 +129,21 @@ bool MediaDecoderJob::Decode( |
base::Unretained(this), |
start_time_ticks, |
start_presentation_timestamp)); |
- return true; |
+ return NULL; |
} |
if (DemuxerStream::kConfigChanged == CurrentAccessUnit().status) { |
// Clear received data because we need to handle a config change. |
decode_cb_.Reset(); |
- ClearData(); |
- return false; |
+ size_t index = CurrentReceivedDataChunkIndex(); |
+ CHECK_EQ(1u, received_data_[index].demuxer_configs.size()); |
+ DemuxerConfigs* config = new DemuxerConfigs(); |
+ CopyDemuxerConfig(&(received_data_[index].demuxer_configs[0]), config); |
wolenetz
2014/05/06 19:06:11
Perhaps my C++ fu is failing me, but:
Since Demux
qinmin
2014/05/06 19:29:34
Done. passing a scoped_ptr to the caller now
On
|
+ return config; |
} |
DecodeCurrentAccessUnit(start_time_ticks, start_presentation_timestamp); |
- return true; |
+ return NULL; |
} |
void MediaDecoderJob::StopDecode() { |
@@ -462,11 +477,15 @@ void MediaDecoderJob::OnDecodeCompleted( |
const AccessUnit& MediaDecoderJob::CurrentAccessUnit() const { |
DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
DCHECK(HasData()); |
- int index = NoAccessUnitsRemainingInChunk(true) ? |
- inactive_demuxer_data_index() : current_demuxer_data_index_; |
+ size_t index = CurrentReceivedDataChunkIndex(); |
return received_data_[index].access_units[access_unit_index_[index]]; |
} |
+size_t MediaDecoderJob::CurrentReceivedDataChunkIndex() const { |
+ return NoAccessUnitsRemainingInChunk(true) ? |
+ inactive_demuxer_data_index() : current_demuxer_data_index_; |
+} |
+ |
bool MediaDecoderJob::NoAccessUnitsRemainingInChunk( |
bool is_active_chunk) const { |
DCHECK(ui_task_runner_->BelongsToCurrentThread()); |