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

Unified Diff: media/base/android/media_decoder_job.cc

Issue 323563002: support adaptive playback in MSE (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_decoder_job.h ('k') | media/base/android/media_source_player_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 97fa39b528dd2257bd9048edeede9ff678d0d71f..082d9b4cadf844c909af9a9f04a3fa7aff74483f 100644
--- a/media/base/android/media_decoder_job.cc
+++ b/media/base/android/media_decoder_job.cc
@@ -289,8 +289,9 @@ MediaCodecStatus MediaDecoderJob::QueueInputBuffer(const AccessUnit& unit) {
bool MediaDecoderJob::HasData() const {
DCHECK(ui_task_runner_->BelongsToCurrentThread());
// When |input_eos_encountered_| is set, |access_unit_index_| and
- // |current_demuxer_data_index_| must be pointing to an EOS unit.
- // We'll reuse this unit to flush the decoder until we hit output EOS.
+ // |current_demuxer_data_index_| must be pointing to an EOS unit,
+ // or a |kConfigChanged| unit if |drain_decoder_| is true. In both cases,
+ // We'll reuse this unit to drain the decoder until we hit output EOS.
wolenetz 2014/06/09 18:22:39 nit: s/We'll/we'll/ and s/reuse this/feed an EOS i
qinmin 2014/06/09 18:55:39 Done.
DCHECK(!input_eos_encountered_ || !NoAccessUnitsRemainingInChunk(true));
return !NoAccessUnitsRemainingInChunk(true) ||
!NoAccessUnitsRemainingInChunk(false);
@@ -332,16 +333,23 @@ void MediaDecoderJob::DecodeCurrentAccessUnit(
const AccessUnit& access_unit = CurrentAccessUnit();
if (CurrentAccessUnit().status == DemuxerStream::kConfigChanged) {
int index = CurrentReceivedDataChunkIndex();
- bool config_changed = SetDemuxerConfigs(
- received_data_[index].demuxer_configs[0]);
- if (config_changed)
+ const DemuxerConfigs& configs = received_data_[index].demuxer_configs[0];
+ bool reconfigure_needed = IsCodecReconfigureNeeded(configs);
+ // TODO(qinmin): |config_changed_cb_| should be ran after draining finishes.
wolenetz 2014/06/09 18:22:39 nit: s/ran/run/ (http://wiki.answers.com/Q/Should_
qinmin 2014/06/09 18:55:39 Done.
+ // http://crbug.com/381975.
+ if (SetDemuxerConfigs(configs))
config_changed_cb_.Run();
if (!drain_decoder_) {
// If we haven't decoded any data yet, just skip the current access unit
// and request the MediaCodec to be recreated on next Decode().
- if (skip_eos_enqueue_ || !config_changed) {
+ // TODO(qinmin): If adaptive playback is enabled, we need to make sure
+ // that the new SPS/PPS and IDR are passed to the decoder in a single
+ // access unit. Need to either combine the access units here or do it at
+ // the chunk demuxer side. See http://crbug.com/381984 and
+ // https://developer.android.com/about/versions/android-4.4.html.
wolenetz 2014/06/09 18:22:39 How will we know if this SPS/PPS/IDR expectation i
qinmin 2014/06/09 18:55:39 Since SPS/PPS/IDR is guaranteed to be the first AU
+ if (skip_eos_enqueue_ || !reconfigure_needed) {
need_to_reconfig_decoder_job_ =
- need_to_reconfig_decoder_job_ || config_changed;
+ need_to_reconfig_decoder_job_ || reconfigure_needed;
ui_task_runner_->PostTask(FROM_HERE, base::Bind(
&MediaDecoderJob::OnDecodeCompleted, base::Unretained(this),
MEDIA_CODEC_OUTPUT_FORMAT_CHANGED, kNoTimestamp(), kNoTimestamp()));
@@ -632,6 +640,13 @@ bool MediaDecoderJob::CreateMediaCodecBridge() {
return CreateMediaCodecBridgeInternal();
}
+bool MediaDecoderJob::IsCodecReconfigureNeeded(
+ const DemuxerConfigs& configs) const {
+ if (!AreDemuxerConfigsChanged(configs))
+ return false;
+ return true;
+}
+
void MediaDecoderJob::ReleaseMediaCodecBridge() {
if (!media_codec_bridge_)
return;
« no previous file with comments | « media/base/android/media_decoder_job.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