Commit b32c1a10 authored by bbudge@chromium.org's avatar bbudge@chromium.org

Pepper: Add VP9 support to PPB_VideoDecoder API.

Improve documentation for Reset and Flush.
Use VpxVideoDecoder in implementation code.

BUG=281689

Review URL: https://codereview.chromium.org/336833003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277860 0039d316-1c4b-4281-b951-d872f2087c98
parent e6a06c8b
......@@ -55,6 +55,8 @@ media::VideoCodecProfile PepperToMediaVideoProfile(PP_VideoProfile profile) {
return media::H264PROFILE_MULTIVIEWHIGH;
case PP_VIDEOPROFILE_VP8MAIN:
return media::VP8PROFILE_MAIN;
case PP_VIDEOPROFILE_VP9MAIN:
return media::VP9PROFILE_MAIN;
// No default case, to catch unhandled PP_VideoProfile values.
}
......
......@@ -18,6 +18,7 @@
#include "media/base/limits.h"
#include "media/base/video_decoder.h"
#include "media/filters/ffmpeg_video_decoder.h"
#include "media/filters/vpx_video_decoder.h"
#include "media/video/picture.h"
#include "media/video/video_decode_accelerator.h"
#include "ppapi/c/pp_errors.h"
......@@ -124,10 +125,15 @@ VideoDecoderShim::DecoderImpl::~DecoderImpl() {
void VideoDecoderShim::DecoderImpl::Initialize(
media::VideoDecoderConfig config) {
DCHECK(!decoder_);
scoped_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder(
new media::FFmpegVideoDecoder(base::MessageLoopProxy::current()));
ffmpeg_video_decoder->set_decode_nalus(true);
decoder_ = ffmpeg_video_decoder.Pass();
if (config.codec() == media::kCodecVP9) {
decoder_.reset(
new media::VpxVideoDecoder(base::MessageLoopProxy::current()));
} else {
scoped_ptr<media::FFmpegVideoDecoder> ffmpeg_video_decoder(
new media::FFmpegVideoDecoder(base::MessageLoopProxy::current()));
ffmpeg_video_decoder->set_decode_nalus(true);
decoder_ = ffmpeg_video_decoder.Pass();
}
max_decodes_at_decoder_ = decoder_->GetMaxDecodeRequests();
// We can use base::Unretained() safely in decoder callbacks because we call
// VideoDecoder::Stop() before deletion. Stop() guarantees there will be no
......@@ -324,6 +330,8 @@ bool VideoDecoderShim::Initialize(
codec = media::kCodecH264;
else if (profile <= media::VP8PROFILE_MAX)
codec = media::kCodecVP8;
else if (profile <= media::VP9PROFILE_MAX)
codec = media::kCodecVP9;
DCHECK_NE(codec, media::kUnknownVideoCodec);
media::VideoDecoderConfig config(
......
......@@ -19,7 +19,8 @@ enum PP_VideoProfile {
PP_VIDEOPROFILE_H264STEREOHIGH = 9,
PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10,
PP_VIDEOPROFILE_VP8MAIN = 11,
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP8MAIN
PP_VIDEOPROFILE_VP9MAIN = 12,
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9MAIN
};
/**
......@@ -45,7 +46,7 @@ struct PP_VideoPicture {
* GL_TEXTURE_2D (normalized texture coordinates)
* GL_TEXTURE_RECTANGLE_ARB (dimension dependent texture coordinates)
*
* The pixel format of the texture is GL_BGRA.
* The pixel format of the texture is GL_RGBA.
*/
uint32_t texture_target;
......
......@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
/* From pp_codecs.idl modified Tue May 6 05:14:19 2014. */
/* From pp_codecs.idl modified Tue Jun 10 13:32:45 2014. */
#ifndef PPAPI_C_PP_CODECS_H_
#define PPAPI_C_PP_CODECS_H_
......@@ -35,7 +35,8 @@ typedef enum {
PP_VIDEOPROFILE_H264STEREOHIGH = 9,
PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10,
PP_VIDEOPROFILE_VP8MAIN = 11,
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP8MAIN
PP_VIDEOPROFILE_VP9MAIN = 12,
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9MAIN
} PP_VideoProfile;
/**
* @}
......@@ -66,7 +67,7 @@ struct PP_VideoPicture {
* GL_TEXTURE_2D (normalized texture coordinates)
* GL_TEXTURE_RECTANGLE_ARB (dimension dependent texture coordinates)
*
* The pixel format of the texture is GL_BGRA.
* The pixel format of the texture is GL_RGBA.
*/
uint32_t texture_target;
/**
......
......@@ -228,7 +228,6 @@ Decoder::Decoder(MyInstance* instance,
next_picture_id_(0),
flushing_(false),
resetting_(false) {
// TODO(bbudge) Remove this for final patch.
#if defined USE_VP8_TESTDATA_INSTEAD_OF_H264
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_VP8MAIN;
#else
......
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