Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_GPU_VIDEO_DECODER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_GPU_VIDEO_DECODER_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "base/message_loop_proxy.h" | |
| 13 #include "base/synchronization/lock.h" | |
| 14 #include "base/synchronization/waitable_event.h" | |
| 15 #include "content/common/content_export.h" | |
| 16 #include "media/base/audio_decoder_config.h" | |
| 17 #include "media/base/decoder_buffer_queue.h" | |
| 18 #include "media/base/demuxer_stream.h" | |
| 19 #include "media/base/pipeline_status.h" | |
| 20 #include "media/base/video_decoder.h" | |
| 21 #include "media/base/video_decoder_config.h" | |
| 22 #include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_i nterface.h" | |
| 23 | |
| 24 namespace content { | |
| 25 | |
| 26 class RTCDemuxerStream : public media::DemuxerStream { | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
Any reason this can't live entirely in the .cc fil
wuchengli
2013/05/08 15:58:56
Done. Moved to .cc file.
On 2013/04/26 00:42:05, A
| |
| 27 public: | |
| 28 // media::DemuxerStream implementation. | |
| 29 virtual void Read(const ReadCB& read_cb) OVERRIDE; | |
| 30 virtual const media::AudioDecoderConfig& audio_decoder_config() OVERRIDE; | |
| 31 virtual const media::VideoDecoderConfig& video_decoder_config() OVERRIDE; | |
| 32 virtual Type type() OVERRIDE; | |
| 33 virtual void EnableBitstreamConverter() OVERRIDE; | |
| 34 | |
| 35 void UpdateSize(gfx::Size size); | |
| 36 void QueueBuffer(scoped_refptr<media::DecoderBuffer> buffer); | |
| 37 | |
| 38 protected: | |
| 39 friend class base::RefCountedThreadSafe<RTCDemuxerStream>; | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
DemuxerStream shouldn't be refcounted anymore so y
wuchengli
2013/05/08 15:58:56
Removed.
On 2013/04/26 00:42:05, Ami Fischman wrot
| |
| 40 | |
| 41 private: | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
Would it make sense to give this a ThreadChecker m
wuchengli
2013/05/08 15:58:56
The constructor and other methods of RTCDemuxerStr
| |
| 42 media::DecoderBufferQueue buffer_queue_; | |
| 43 ReadCB read_cb_; | |
| 44 | |
| 45 media::AudioDecoderConfig dummy_audio_decoder_config_; | |
| 46 media::VideoDecoderConfig video_decoder_config_; | |
| 47 }; | |
| 48 | |
| 49 class CONTENT_EXPORT RTCVideoDecoderBridge | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
Could benefit from commentary saying where this fi
Pawel Osciak
2013/04/26 07:08:01
Let's rename this to RTCVideoDecoder, we don't hav
wuchengli
2013/05/08 15:58:56
Done. Renamed to RTCVideoDecoder.
wuchengli
2013/05/09 15:43:14
Done. I added some comments.
| |
| 50 : NON_EXPORTED_BASE(public webrtc::VideoDecoder), | |
| 51 public base::SupportsWeakPtr<RTCVideoDecoderBridge> { | |
| 52 public: | |
| 53 RTCVideoDecoderBridge( | |
| 54 scoped_refptr<media::VideoDecoder> video_decoder, | |
| 55 const scoped_refptr<base::MessageLoopProxy>& message_loop); | |
| 56 virtual ~RTCVideoDecoderBridge(); | |
| 57 | |
| 58 // webrtc::VideoDecoder implementation. | |
| 59 virtual WebRtc_Word32 InitDecode( | |
| 60 const webrtc::VideoCodec* codecSettings, | |
| 61 WebRtc_Word32 numberOfCores) OVERRIDE; | |
| 62 virtual WebRtc_Word32 Decode( | |
| 63 const webrtc::EncodedImage& inputImage, | |
| 64 bool missingFrames, | |
| 65 const webrtc::RTPFragmentationHeader* fragmentation, | |
| 66 const webrtc::CodecSpecificInfo* codecSpecificInfo = NULL, | |
| 67 WebRtc_Word64 renderTimeMs = -1) OVERRIDE; | |
| 68 virtual WebRtc_Word32 RegisterDecodeCompleteCallback( | |
| 69 webrtc::DecodedImageCallback* callback) OVERRIDE; | |
| 70 virtual WebRtc_Word32 Release() OVERRIDE; | |
| 71 virtual WebRtc_Word32 Reset() OVERRIDE; | |
| 72 | |
| 73 private: | |
| 74 static const base::TimeDelta kDecoderTimeOut; | |
| 75 enum Status { | |
|
Pawel Osciak
2013/04/26 07:08:01
s/Status/State maybe?
wuchengli
2013/05/08 15:58:56
Done.
On 2013/04/26 07:08:01, posciak wrote:
| |
| 76 kNoInit, | |
|
Pawel Osciak
2013/04/26 07:08:01
s/kNoInit/kUninitialized ?
wuchengli
2013/05/08 15:58:56
Done.
| |
| 77 kInitialized, | |
| 78 kDecoding, | |
| 79 kReseting, | |
| 80 kReleased, | |
|
Pawel Osciak
2013/04/26 07:08:01
Not needed, use kNoInit/kUninitialized instead?
wuchengli
2013/05/08 15:58:56
Done.
| |
| 81 }; | |
| 82 | |
| 83 scoped_refptr<media::VideoDecoder> video_decoder_; | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
I suspect you need to rebase since this is no long
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
Members whose use/purpose is non-obvious should be
wuchengli
2013/05/08 15:58:56
Rebased.
On 2013/04/26 00:42:05, Ami Fischman wrot
wuchengli
2013/05/09 15:43:14
Comment added for member variables.
| |
| 84 scoped_refptr<base::MessageLoopProxy> loop_proxy_; | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
improve name
| |
| 85 webrtc::DecodedImageCallback* decode_complete_callback_; | |
| 86 media::PipelineStatus pipeline_status_; | |
| 87 base::WaitableEvent decoder_init_waiter_; | |
| 88 base::WaitableEvent decoder_reset_waiter_; | |
| 89 scoped_refptr<RTCDemuxerStream> stream_; | |
| 90 gfx::Size size_; | |
| 91 Status status_; | |
| 92 webrtc::I420VideoFrame decoded_image_; | |
|
Pawel Osciak
2013/04/26 07:08:01
Does this need to be a class member?
wuchengli
2013/05/08 15:58:56
Removed.
On 2013/04/26 07:08:01, posciak wrote:
| |
| 93 | |
| 94 base::Lock lock_; | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
This is begging for an explanation of what needs t
| |
| 95 typedef std::list<scoped_refptr<media::VideoFrame> > VideoFrameList; | |
| 96 VideoFrameList ready_video_frames_; // protected by |lock_| | |
| 97 bool decoding_error_occured_; // protected by |lock_| | |
| 98 | |
| 99 void OnUpdateStatistics(const media::PipelineStatistics& stats); | |
|
Ami GONE FROM CHROMIUM
2013/04/26 00:42:05
nit: methods go before members
wuchengli
2013/05/08 15:58:56
Done.
| |
| 100 void OnUpdatePipelineStatus(const media::PipelineStatus status); | |
| 101 void ResetComplete(); | |
| 102 void FrameReady( | |
| 103 media::VideoDecoder::Status status, | |
| 104 const scoped_refptr<media::VideoFrame>& frame); | |
| 105 void RequestFrame(); | |
| 106 | |
| 107 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderBridge); | |
| 108 }; | |
| 109 | |
| 110 } // namespace content | |
| 111 | |
| 112 #endif // CONTENT_RENDERER_MEDIA_RTC_GPU_VIDEO_DECODER_H_ | |
| OLD | NEW |