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

Side by Side Diff: media/cast/video_receiver/video_decoder.cc

Issue 59753007: Passing frame decoded callback to the codec (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responding to review Created 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/cast/video_receiver/video_decoder.h" 5 #include "media/cast/video_receiver/video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h" 10 #include "media/cast/video_receiver/codecs/vp8/vp8_decoder.h"
11 11
12 namespace media { 12 namespace media {
13 namespace cast { 13 namespace cast {
14 14
15 VideoDecoder::VideoDecoder(const VideoReceiverConfig& video_config) 15 VideoDecoder::VideoDecoder(const VideoReceiverConfig& video_config,
16 scoped_refptr<CastEnvironment> cast_environment)
16 : codec_(video_config.codec), 17 : codec_(video_config.codec),
17 vp8_decoder_() { 18 vp8_decoder_() {
18 switch (video_config.codec) { 19 switch (video_config.codec) {
19 case kVp8: 20 case kVp8:
20 // Initializing to use one core. 21 // Initializing to use one core.
21 vp8_decoder_.reset(new Vp8Decoder(1)); 22 vp8_decoder_.reset(new Vp8Decoder(1, cast_environment));
22 break; 23 break;
23 case kH264: 24 case kH264:
24 NOTIMPLEMENTED(); 25 NOTIMPLEMENTED();
25 break; 26 break;
26 case kExternalVideo: 27 case kExternalVideo:
27 DCHECK(false) << "Invalid codec"; 28 DCHECK(false) << "Invalid codec";
28 break; 29 break;
29 } 30 }
30 } 31 }
31 32
32 VideoDecoder::~VideoDecoder() {} 33 VideoDecoder::~VideoDecoder() {}
33 34
34 bool VideoDecoder::DecodeVideoFrame( 35 bool VideoDecoder::DecodeVideoFrame(const EncodedVideoFrame* encoded_frame,
35 const EncodedVideoFrame* encoded_frame, 36 const base::TimeTicks render_time,
36 const base::TimeTicks render_time, 37 const VideoFrameDecodedCallback
37 I420VideoFrame* video_frame) { 38 frame_decoded_cb) {
38 DCHECK(encoded_frame->codec == codec_) << "Invalid codec"; 39 DCHECK(encoded_frame->codec == codec_) << "Invalid codec";
39 DCHECK_GT(encoded_frame->data.size(), GG_UINT64_C(0)) << "Empty video frame"; 40 DCHECK_GT(encoded_frame->data.size(), GG_UINT64_C(0)) << "Empty video frame";
40 return vp8_decoder_->Decode(*encoded_frame, video_frame); 41 return vp8_decoder_->Decode(encoded_frame, render_time, frame_decoded_cb);
41 } 42 }
42 43
43 } // namespace cast 44 } // namespace cast
44 } // namespace media 45 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698