Fix no ContentProtection element problem.

The original code used stream_info.is_encrypted() to check whether output
stream is encrypted; However, stream_info contains input stream
information and does not contain output stream infomation, which results
in incorrect status was passed to mpd generator. Fix the problem with
correct information from muxer.

Change on behalf of rkuroiwa after a discussion with him.

Bug: 12994813

Change-Id: I6e74b378a0fd7deedaaac166e913a66d312b8318
This commit is contained in:
Kongqun Yang 2014-02-12 16:35:05 -08:00 committed by KongQun Yang
parent 859da912fc
commit b93f2020c8
8 changed files with 18 additions and 9 deletions

View File

@ -21,7 +21,7 @@ const char kUsage[] =
" There will be at most 3 AdaptationSets in the MPD, i.e. 1 video, 1 "
"audio, and 1 text.\n"
"Sample Usage:\n"
"%s --input=\"video1.txt,video2.txt,audio1.txt\" "
"%s --input=\"video1.media_info,video2.media_info,audio1.media_info\" "
"--output=\"video_audio.mpd\"";
enum ExitStatus {

View File

@ -61,7 +61,8 @@ class MuxerListener {
uint64 index_range_start,
uint64 index_range_end,
float duration_seconds,
uint64 file_size) = 0;
uint64 file_size,
bool is_encrypted) = 0;
// Called when a segment has been muxed and the file has been written.
// Note: For video on demand (VOD), this would be for subsegments.

View File

@ -62,7 +62,8 @@ void VodMediaInfoDumpMuxerListener::OnMediaEnd(
uint64 index_range_start,
uint64 index_range_end,
float duration_seconds,
uint64 file_size) {
uint64 file_size,
bool is_encrypted) {
MediaInfo media_info;
if (!internal::GenerateMediaInfo(muxer_options_,
stream_infos,
@ -81,7 +82,7 @@ void VodMediaInfoDumpMuxerListener::OnMediaEnd(
return;
}
if (IsAnyStreamEncrypted(stream_infos)) {
if (is_encrypted) {
if (scheme_id_uri_.empty()) {
LOG(ERROR) << "The stream is encrypted but no schemeIdUri specified for "
"ContentProtection.";

View File

@ -46,6 +46,7 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener {
uint32 time_scale,
ContainerType container_type) OVERRIDE;
// TODO(rkuroiwa): Make an Event structure for passing parameters.
virtual void OnMediaEnd(const std::vector<StreamInfo*>& stream_infos,
bool has_init_range,
uint64 init_range_start,
@ -54,7 +55,8 @@ class VodMediaInfoDumpMuxerListener : public MuxerListener {
uint64 index_range_start,
uint64 index_range_end,
float duration_seconds,
uint64 file_size) OVERRIDE;
uint64 file_size,
bool is_encrypted) OVERRIDE;
virtual void OnNewSegment(uint64 start_time,
uint64 duration,

View File

@ -46,6 +46,7 @@ struct OnMediaEndParameters {
uint64 index_range_end;
float duration_seconds;
uint64 file_size;
bool is_encrypted;
};
scoped_refptr<StreamInfo> CreateVideoStreamInfo(
@ -185,7 +186,8 @@ class VodMediaInfoDumpMuxerListenerTest : public ::testing::Test {
params.index_range_start,
params.index_range_end,
params.duration_seconds,
params.file_size);
params.file_size,
params.is_encrypted);
}
void ExpectTempFileToEqual(const std::string& expected_protobuf) {

View File

@ -47,7 +47,8 @@ void VodMpdNotifyMuxerListener::OnMediaEnd(
uint64 index_range_start,
uint64 index_range_end,
float duration_seconds,
uint64 file_size) {
uint64 file_size,
bool is_encrypted) {
dash_packager::MediaInfo media_info;
if (!internal::GenerateMediaInfo(muxer_options_,
stream_infos,

View File

@ -43,7 +43,8 @@ class VodMpdNotifyMuxerListener : public MuxerListener {
uint64 index_range_start,
uint64 index_range_end,
float duration_seconds,
uint64 file_size) OVERRIDE;
uint64 file_size,
bool is_encrypted) OVERRIDE;
virtual void OnNewSegment(uint64 start_time,
uint64 duration,

View File

@ -325,7 +325,8 @@ void MP4Muxer::FireOnMediaEndEvent() {
index_range_start,
index_range_end,
duration_seconds,
file_size);
file_size,
IsEncryptionRequired());
}
} // namespace mp4