summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 04:04:56 +0000
committerddorwin@chromium.org <ddorwin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 04:04:56 +0000
commit3157a9fde73cc3532348b82d2365da98f00bd772 (patch)
tree932a0a696174432d4b86e5eaa31b69b5b711bbe6 /media
parentaf0899738a7350f81d306a8a5104fd275f327a7c (diff)
downloadchromium_src-3157a9fde73cc3532348b82d2365da98f00bd772.zip
chromium_src-3157a9fde73cc3532348b82d2365da98f00bd772.tar.gz
chromium_src-3157a9fde73cc3532348b82d2365da98f00bd772.tar.bz2
Fix CHECK failure processing unencrypted frames within a potentially encrypted ISO CENC stream.
BUG=168852 TEST=URL in bug; unit tests in a forthcoming CL Review URL: https://chromiumcodereview.appspot.com/11818037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/mp4/mp4_stream_parser.cc28
-rw-r--r--media/mp4/mp4_stream_parser.h2
2 files changed, 23 insertions, 7 deletions
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 38333fb..3f9b016 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -31,7 +31,9 @@ MP4StreamParser::MP4StreamParser(bool has_sbr)
has_video_(false),
audio_track_id_(0),
video_track_id_(0),
- has_sbr_(has_sbr) {
+ has_sbr_(has_sbr),
+ is_audio_track_encrypted_(false),
+ is_video_track_encrypted_(false) {
}
MP4StreamParser::~MP4StreamParser() {}
@@ -220,11 +222,12 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
return false;
}
- bool is_encrypted = entry.sinf.info.track_encryption.is_encrypted;
+ is_audio_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted;
+ DVLOG(1) << "is_audio_track_encrypted_: " << is_audio_track_encrypted_;
audio_config.Initialize(kCodecAAC, sample_format,
aac.channel_layout(),
aac.GetOutputSamplesPerSecond(has_sbr_),
- NULL, 0, is_encrypted, false);
+ NULL, 0, is_audio_track_encrypted_, false);
has_audio_ = true;
audio_track_id_ = track->header.track_id;
}
@@ -248,12 +251,13 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
gfx::Size natural_size = GetNaturalSize(visible_rect.size(),
entry.pixel_aspect.h_spacing,
entry.pixel_aspect.v_spacing);
- bool is_encrypted = entry.sinf.info.track_encryption.is_encrypted;
+ is_video_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted;
+ DVLOG(1) << "is_video_track_encrypted_: " << is_video_track_encrypted_;
video_config.Initialize(kCodecH264, H264PROFILE_MAIN, VideoFrame::YV12,
coded_size, visible_rect, natural_size,
// No decoder-specific buffer needed for AVC;
// SPS/PPS are embedded in the video stream
- NULL, 0, is_encrypted, true);
+ NULL, 0, is_video_track_encrypted_, true);
has_video_ = true;
video_track_id_ = track->header.track_id;
}
@@ -446,19 +450,29 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
}
}
- if (decrypt_config.get() != NULL && !subsamples.empty()) {
+ if (decrypt_config) {
+ if (!subsamples.empty()) {
+ // Create a new config with the updated subsamples.
decrypt_config.reset(new DecryptConfig(
decrypt_config->key_id(),
decrypt_config->iv(),
decrypt_config->data_offset(),
subsamples));
+ }
+ // else, use the existing config.
+ } else if ((audio && is_audio_track_encrypted_) ||
+ (video && is_video_track_encrypted_)) {
+ // The media pipeline requires a DecryptConfig with an empty |iv|.
+ // TODO(ddorwin): Refactor so we do not need a fake key ID ("1");
+ decrypt_config.reset(
+ new DecryptConfig("1", "", 0, std::vector<SubsampleEntry>()));
}
scoped_refptr<StreamParserBuffer> stream_buf =
StreamParserBuffer::CopyFrom(&frame_buf[0], frame_buf.size(),
runs_->is_keyframe());
- if (runs_->is_encrypted())
+ if (decrypt_config)
stream_buf->SetDecryptConfig(decrypt_config.Pass());
stream_buf->SetDuration(runs_->duration());
diff --git a/media/mp4/mp4_stream_parser.h b/media/mp4/mp4_stream_parser.h
index 292f628..05206ef 100644
--- a/media/mp4/mp4_stream_parser.h
+++ b/media/mp4/mp4_stream_parser.h
@@ -108,6 +108,8 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
uint32 audio_track_id_;
uint32 video_track_id_;
bool has_sbr_;
+ bool is_audio_track_encrypted_;
+ bool is_video_track_encrypted_;
DISALLOW_COPY_AND_ASSIGN(MP4StreamParser);
};