From fe744f4724fa5f792c4b7682957f2e85879b5a69 Mon Sep 17 00:00:00 2001 From: Thomas Inskip Date: Thu, 29 May 2014 13:21:28 -0700 Subject: [PATCH] Made video decoder configuration changes into a non-fatal condition. Issued warning rather than exiting with an error so that playback may (hopefully) continue. We see this type of situation with the Envivio encoders, which effect trivial changes in encoding midstream. Change-Id: Ifa552066f602157adbfa0b882cb75e479b067645 --- media/base/stream_info.h | 2 ++ media/formats/mp2t/es_parser_h264.cc | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/media/base/stream_info.h b/media/base/stream_info.h index d1c5d3797a..770e74d176 100644 --- a/media/base/stream_info.h +++ b/media/base/stream_info.h @@ -52,6 +52,8 @@ class StreamInfo : public base::RefCountedThreadSafe { void set_duration(int duration) { duration_ = duration; } + void set_extra_data(const std::vector& data) { extra_data_ = data; } + protected: friend class base::RefCountedThreadSafe; virtual ~StreamInfo(); diff --git a/media/formats/mp2t/es_parser_h264.cc b/media/formats/mp2t/es_parser_h264.cc index 986e7ac00a..472b9fa197 100644 --- a/media/formats/mp2t/es_parser_h264.cc +++ b/media/formats/mp2t/es_parser_h264.cc @@ -316,13 +316,16 @@ bool EsParserH264::UpdateVideoDecoderConfig(const H264SPS* sps) { } if (last_video_decoder_config_) { - // Verify that the video decoder config has not changed. - if (last_video_decoder_config_->extra_data() == decoder_config_record) { - // Video configuration has not changed. - return true; + if (last_video_decoder_config_->extra_data() != decoder_config_record) { + // Video configuration has changed. Issue warning. + // TODO(tinskip): Check the nature of the configuration change. Only + // minor configuration changes (such as frame ordering) can be handled + // gracefully by decoders without notification. Major changes (such as + // video resolution changes) should be treated as errors. + LOG(WARNING) << "H.264 decoder configuration has changed."; + last_video_decoder_config_->set_extra_data(decoder_config_record); } - NOTIMPLEMENTED() << "Varying video configurations are not supported."; - return false; + return true; } // TODO: a MAP unit can be either 16 or 32 pixels.