Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Side by Side Diff: remoting/base/decoder_vp8.cc

Issue 4229003: Add VideoReader and VideoWriter interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/service/service_process.cc ('k') | remoting/base/encoder_vp8.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/base/decoder_vp8.h" 5 #include "remoting/base/decoder_vp8.h"
6 6
7 #include "media/base/media.h" 7 #include "media/base/media.h"
8 #include "media/base/yuv_convert.h" 8 #include "media/base/yuv_convert.h"
9 #include "remoting/base/util.h" 9 #include "remoting/base/util.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 (const vpx_codec_iface_t*)media::GetVp8DxAlgoAddress(), NULL, 0); 56 (const vpx_codec_iface_t*)media::GetVp8DxAlgoAddress(), NULL, 0);
57 if (ret != VPX_CODEC_OK) { 57 if (ret != VPX_CODEC_OK) {
58 LOG(INFO) << "Cannot initialize codec."; 58 LOG(INFO) << "Cannot initialize codec.";
59 delete codec_; 59 delete codec_;
60 codec_ = NULL; 60 codec_ = NULL;
61 state_ = kError; 61 state_ = kError;
62 return; 62 return;
63 } 63 }
64 } 64 }
65 65
66 LOG(WARNING) << "Decoding " << encoded_bytes.size();
67
68 // Do the actual decoding. 66 // Do the actual decoding.
69 vpx_codec_err_t ret = vpx_codec_decode( 67 vpx_codec_err_t ret = vpx_codec_decode(
70 codec_, reinterpret_cast<const uint8*>(encoded_bytes.data()), 68 codec_, reinterpret_cast<const uint8*>(encoded_bytes.data()),
71 encoded_bytes.size(), NULL, 0); 69 encoded_bytes.size(), NULL, 0);
72 if (ret != VPX_CODEC_OK) { 70 if (ret != VPX_CODEC_OK) {
73 LOG(INFO) << "Decoding failed:" << vpx_codec_err_to_string(ret) << "\n" 71 LOG(INFO) << "Decoding failed:" << vpx_codec_err_to_string(ret) << "\n"
74 << "Details: " << vpx_codec_error(codec_) << "\n" 72 << "Details: " << vpx_codec_error(codec_) << "\n"
75 << vpx_codec_error_detail(codec_); 73 << vpx_codec_error_detail(codec_);
74 return;
76 } 75 }
77 76
78 // Gets the decoded data. 77 // Gets the decoded data.
79 vpx_codec_iter_t iter = NULL; 78 vpx_codec_iter_t iter = NULL;
80 vpx_image_t* image = vpx_codec_get_frame(codec_, &iter); 79 vpx_image_t* image = vpx_codec_get_frame(codec_, &iter);
81 if (!image) { 80 if (!image) {
82 LOG(INFO) << "No video frame decoded"; 81 LOG(INFO) << "No video frame decoded";
82 return;
83 } 83 }
84 84
85 // Perform YUV conversion. 85 // Perform YUV conversion.
86 media::ConvertYUVToRGB32(image->planes[0], image->planes[1], image->planes[2], 86 media::ConvertYUVToRGB32(image->planes[0], image->planes[1], image->planes[2],
87 frame_->data(media::VideoFrame::kRGBPlane), 87 frame_->data(media::VideoFrame::kRGBPlane),
88 frame_->width(), frame_->height(), 88 frame_->width(), frame_->height(),
89 image->stride[0], image->stride[1], 89 image->stride[0], image->stride[1],
90 frame_->stride(media::VideoFrame::kRGBPlane), 90 frame_->stride(media::VideoFrame::kRGBPlane),
91 media::YV12); 91 media::YV12);
92 } 92 }
93 93
94 void DecoderVp8::Reset() { 94 void DecoderVp8::Reset() {
95 frame_ = NULL; 95 frame_ = NULL;
96 state_ = kUninitialized; 96 state_ = kUninitialized;
97 } 97 }
98 98
99 bool DecoderVp8::IsReadyForData() { 99 bool DecoderVp8::IsReadyForData() {
100 return state_ == kReady; 100 return state_ == kReady;
101 } 101 }
102 102
103 VideoPacketFormat::Encoding DecoderVp8::Encoding() { 103 VideoPacketFormat::Encoding DecoderVp8::Encoding() {
104 return VideoPacketFormat::ENCODING_VP8; 104 return VideoPacketFormat::ENCODING_VP8;
105 } 105 }
106 106
107 } // namespace remoting 107 } // namespace remoting
OLDNEW
« no previous file with comments | « chrome/service/service_process.cc ('k') | remoting/base/encoder_vp8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698