summaryrefslogtreecommitdiffstats
path: root/remoting/codec
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 01:53:39 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-22 01:53:39 +0000
commit87196ce1202e3fdbaff773b40374995f8a14aca3 (patch)
tree71c696306305596a3ae31230dc9628c6fc8a5cbb /remoting/codec
parent6be0c2a3d8906f07f98a55212633c91c913b0d6f (diff)
downloadchromium_src-87196ce1202e3fdbaff773b40374995f8a14aca3.zip
chromium_src-87196ce1202e3fdbaff773b40374995f8a14aca3.tar.gz
chromium_src-87196ce1202e3fdbaff773b40374995f8a14aca3.tar.bz2
Add VP9 decode support to the remoting client.
BUG=260879 Review URL: https://codereview.chromium.org/26921005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/codec')
-rw-r--r--remoting/codec/video_decoder_vpx.cc20
-rw-r--r--remoting/codec/video_decoder_vpx.h3
-rw-r--r--remoting/codec/video_encoder_vpx.cc5
-rw-r--r--remoting/codec/video_encoder_vpx.h3
4 files changed, 28 insertions, 3 deletions
diff --git a/remoting/codec/video_decoder_vpx.cc b/remoting/codec/video_decoder_vpx.cc
index ba65e88..156c233 100644
--- a/remoting/codec/video_decoder_vpx.cc
+++ b/remoting/codec/video_decoder_vpx.cc
@@ -61,6 +61,26 @@ scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP8() {
return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
}
+// static
+scoped_ptr<VideoDecoderVpx> VideoDecoderVpx::CreateForVP9() {
+ ScopedVpxCodec codec(new vpx_codec_ctx_t);
+
+ // TODO(hclam): Scale the number of threads with number of cores of the
+ // machine.
+ vpx_codec_dec_cfg config;
+ config.w = 0;
+ config.h = 0;
+ config.threads = 2;
+ vpx_codec_err_t ret =
+ vpx_codec_dec_init(codec.get(), vpx_codec_vp9_dx(), &config, 0);
+ if (ret != VPX_CODEC_OK) {
+ LOG(INFO) << "Cannot initialize codec.";
+ return scoped_ptr<VideoDecoderVpx>();
+ }
+
+ return scoped_ptr<VideoDecoderVpx>(new VideoDecoderVpx(codec.Pass()));
+}
+
VideoDecoderVpx::~VideoDecoderVpx() {}
void VideoDecoderVpx::Initialize(const webrtc::DesktopSize& screen_size) {
diff --git a/remoting/codec/video_decoder_vpx.h b/remoting/codec/video_decoder_vpx.h
index 800c873..3f2fcfb 100644
--- a/remoting/codec/video_decoder_vpx.h
+++ b/remoting/codec/video_decoder_vpx.h
@@ -18,8 +18,9 @@ namespace remoting {
class VideoDecoderVpx : public VideoDecoder {
public:
- // Creates a decoder for VP8.
+ // Create decoders for the specified protocol.
static scoped_ptr<VideoDecoderVpx> CreateForVP8();
+ static scoped_ptr<VideoDecoderVpx> CreateForVP9();
virtual ~VideoDecoderVpx();
diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc
index 6c39d47..02df60b 100644
--- a/remoting/codec/video_encoder_vpx.cc
+++ b/remoting/codec/video_encoder_vpx.cc
@@ -197,6 +197,11 @@ bool VideoEncoderVpx::Initialize(const webrtc::DesktopSize& size) {
image_->d_h = size.height();
image_->h = size.height();
+ // libvpx should derive this from|fmt| but currently has a bug:
+ // https://code.google.com/p/webm/issues/detail?id=627
+ image_->x_chroma_shift = 1;
+ image_->y_chroma_shift = 1;
+
// Initialize active map.
active_map_width_ = (image_->w + kMacroBlockSize - 1) / kMacroBlockSize;
active_map_height_ = (image_->h + kMacroBlockSize - 1) / kMacroBlockSize;
diff --git a/remoting/codec/video_encoder_vpx.h b/remoting/codec/video_encoder_vpx.h
index 2e76532..f847bb5 100644
--- a/remoting/codec/video_encoder_vpx.h
+++ b/remoting/codec/video_encoder_vpx.h
@@ -18,10 +18,9 @@ class DesktopSize;
namespace remoting {
-// A class that uses VP8 to perform encoding.
class VideoEncoderVpx : public VideoEncoder {
public:
- // Creates a encoder for VP8.
+ // Create encoder for the specified protocol.
static scoped_ptr<VideoEncoderVpx> CreateForVP8();
virtual ~VideoEncoderVpx();