media: Support VP9 in media source.


Review URL: https://chromiumcodereview.appspot.com/13652011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192672 0039d316-1c4b-4281-b951-d872f2087c98
parent 3d9f7431
...@@ -21,6 +21,7 @@ static const char kClearKeySystem[] = "org.w3.clearkey"; ...@@ -21,6 +21,7 @@ static const char kClearKeySystem[] = "org.w3.clearkey";
static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 };
static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\"";
static const char kWebMVP9[] = "video/webm; codecs=\"vp9\"";
static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\"";
static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\"";
static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
...@@ -51,6 +52,7 @@ static const int k640WebMFileDurationMs = 2763; ...@@ -51,6 +52,7 @@ static const int k640WebMFileDurationMs = 2763;
static const int k640IsoFileDurationMs = 2737; static const int k640IsoFileDurationMs = 2737;
static const int k640IsoCencFileDurationMs = 2736; static const int k640IsoCencFileDurationMs = 2736;
static const int k1280IsoFileDurationMs = 2736; static const int k1280IsoFileDurationMs = 2736;
static const int kVP9WebMFileDurationMs = 2736;
// Note: Tests using this class only exercise the DecryptingDemuxerStream path. // Note: Tests using this class only exercise the DecryptingDemuxerStream path.
// They do not exercise the Decrypting{Audio|Video}Decoder path. // They do not exercise the Decrypting{Audio|Video}Decoder path.
...@@ -455,6 +457,28 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { ...@@ -455,6 +457,28 @@ TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) {
Stop(); Stop();
} }
// TODO(tomfinegan): Enable this test when the VP9 bitstream is finalized, and
// http://crbug.com/173333 is fixed.
TEST_F(PipelineIntegrationTest,
DISABLED_BasicPlayback_MediaSource_VideoOnly_VP9_WebM) {
MockMediaSource source("bear-vp9.webm", kWebMVP9, 19324);
StartPipelineWithMediaSource(&source);
source.EndOfStream();
EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
EXPECT_EQ(kVP9WebMFileDurationMs,
pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
Play();
ASSERT_TRUE(WaitUntilOnEnded());
source.Abort();
Stop();
}
TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) {
MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
kAppendWholeFile); kAppendWholeFile);
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
#include "media/filters/stream_parser_factory.h" #include "media/filters/stream_parser_factory.h"
#include "base/command_line.h"
#include "base/string_number_conversions.h" #include "base/string_number_conversions.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "media/base/media_log.h" #include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/webm/webm_stream_parser.h" #include "media/webm/webm_stream_parser.h"
#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
...@@ -42,10 +44,12 @@ struct SupportedTypeInfo { ...@@ -42,10 +44,12 @@ struct SupportedTypeInfo {
}; };
static const CodecInfo kVP8CodecInfo = { "vp8", CodecInfo::VIDEO, NULL }; static const CodecInfo kVP8CodecInfo = { "vp8", CodecInfo::VIDEO, NULL };
static const CodecInfo kVP9CodecInfo = { "vp9", CodecInfo::VIDEO, NULL };
static const CodecInfo kVorbisCodecInfo = { "vorbis", CodecInfo::AUDIO, NULL }; static const CodecInfo kVorbisCodecInfo = { "vorbis", CodecInfo::AUDIO, NULL };
static const CodecInfo* kVideoWebMCodecs[] = { static const CodecInfo* kVideoWebMCodecs[] = {
&kVP8CodecInfo, &kVP8CodecInfo,
&kVP9CodecInfo,
&kVorbisCodecInfo, &kVorbisCodecInfo,
NULL NULL
}; };
...@@ -205,11 +209,19 @@ static bool IsSupported(const std::string& type, ...@@ -205,11 +209,19 @@ static bool IsSupported(const std::string& type,
return false; return false;
} }
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
switch (codec_type) { switch (codec_type) {
case CodecInfo::AUDIO: case CodecInfo::AUDIO:
*has_audio = true; *has_audio = true;
break; break;
case CodecInfo::VIDEO: case CodecInfo::VIDEO:
// TODO(tomfinegan): Remove this check (or negate it, if we just
// negate the flag) when VP9 is enabled by default.
if (MatchPattern(codec_id, kVP9CodecInfo.pattern) &&
!cmd_line->HasSwitch(switches::kEnableVp9Playback)) {
return false;
}
*has_video = true; *has_video = true;
break; break;
default: default:
......
...@@ -39,6 +39,9 @@ bool WebMVideoClient::InitializeConfig( ...@@ -39,6 +39,9 @@ bool WebMVideoClient::InitializeConfig(
if (codec_id == "V_VP8") { if (codec_id == "V_VP8") {
video_codec = kCodecVP8; video_codec = kCodecVP8;
profile = VP8PROFILE_MAIN; profile = VP8PROFILE_MAIN;
} else if (codec_id == "V_VP9") {
video_codec = kCodecVP9;
profile = VP9PROFILE_MAIN;
} else { } else {
MEDIA_LOG(log_cb_) << "Unsupported video codec_id " << codec_id; MEDIA_LOG(log_cb_) << "Unsupported video codec_id " << codec_id;
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment