Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "media/base/filters.h" | 16 #include "media/base/filters.h" |
| 17 #include "media/base/video_frame.h" | 17 #include "media/base/video_frame.h" |
| 18 #include "third_party/libjingle/source/talk/session/phone/mediachannel.h" | 18 #include "third_party/libjingle/source/talk/session/phone/mediachannel.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 29 NON_EXPORTED_BASE(public cricket::VideoRenderer) { | 29 NON_EXPORTED_BASE(public cricket::VideoRenderer) { |
| 30 public: | 30 public: |
| 31 RTCVideoDecoder(MessageLoop* message_loop, const std::string& url); | 31 RTCVideoDecoder(MessageLoop* message_loop, const std::string& url); |
| 32 virtual ~RTCVideoDecoder(); | 32 virtual ~RTCVideoDecoder(); |
| 33 | 33 |
| 34 // Filter implementation. | 34 // Filter implementation. |
| 35 virtual void Play(const base::Closure& callback) OVERRIDE; | 35 virtual void Play(const base::Closure& callback) OVERRIDE; |
| 36 virtual void Seek(base::TimeDelta time, | 36 virtual void Seek(base::TimeDelta time, |
| 37 const media::FilterStatusCB& cb) OVERRIDE; | 37 const media::FilterStatusCB& cb) OVERRIDE; |
| 38 virtual void Pause(const base::Closure& callback) OVERRIDE; | 38 virtual void Pause(const base::Closure& callback) OVERRIDE; |
| 39 virtual void Flush(const base::Closure& callback) OVERRIDE; | |
| 39 virtual void Stop(const base::Closure& callback) OVERRIDE; | 40 virtual void Stop(const base::Closure& callback) OVERRIDE; |
| 40 | 41 |
| 41 // Decoder implementation. | 42 // Decoder implementation. |
| 42 virtual void Initialize( | 43 virtual void Initialize( |
| 43 media::DemuxerStream* demuxer_stream, | 44 media::DemuxerStream* demuxer_stream, |
| 44 const base::Closure& filter_callback, | 45 const base::Closure& filter_callback, |
| 45 const media::StatisticsCallback& stat_callback) OVERRIDE; | 46 const media::StatisticsCallback& stat_callback) OVERRIDE; |
| 46 virtual void Read(const ReadCB& callback) OVERRIDE; | 47 virtual void Read(const ReadCB& callback) OVERRIDE; |
| 47 virtual const gfx::Size& natural_size() OVERRIDE; | 48 virtual const gfx::Size& natural_size() OVERRIDE; |
| 48 | 49 |
| 49 // cricket::VideoRenderer implementation | 50 // cricket::VideoRenderer implementation |
| 50 virtual bool SetSize(int width, int height, int reserved) OVERRIDE; | 51 virtual bool SetSize(int width, int height, int reserved) OVERRIDE; |
| 51 virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; | 52 virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; |
| 52 | 53 |
| 54 // Helper. | |
|
scherkus (not reviewing)
2011/11/17 02:05:22
ditto
| |
| 55 void DeliverBlackFrame(const ReadCB& read_cb); | |
|
scherkus (not reviewing)
2011/11/17 02:05:22
should this be private?
| |
| 56 | |
| 53 private: | 57 private: |
| 54 friend class RTCVideoDecoderTest; | 58 friend class RTCVideoDecoderTest; |
| 55 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful); | 59 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful); |
| 56 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSeek); | 60 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSeek); |
| 61 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoFlush); | |
| 57 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoRenderFrame); | 62 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoRenderFrame); |
| 58 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSetSize); | 63 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSetSize); |
| 59 | 64 |
| 60 enum DecoderState { | 65 enum DecoderState { |
| 61 kUnInitialized, | 66 kUnInitialized, |
| 62 kNormal, | 67 kNormal, |
| 63 kPaused, | 68 kPaused, |
| 64 kStopped | 69 kStopped |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 MessageLoop* message_loop_; | 72 MessageLoop* message_loop_; |
| 68 gfx::Size visible_size_; | 73 gfx::Size visible_size_; |
| 69 std::string url_; | 74 std::string url_; |
| 70 DecoderState state_; | 75 DecoderState state_; |
| 71 ReadCB read_cb_; | 76 std::queue<ReadCB> read_cbs_; |
|
scherkus (not reviewing)
2011/11/17 02:05:22
ditto
| |
| 72 | 77 |
| 73 // Used for accessing |read_cb_| from another thread. | 78 // Used for accessing |read_cbs_| from another thread. |
| 74 base::Lock lock_; | 79 base::Lock lock_; |
| 75 | 80 |
| 76 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 81 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 84 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
| OLD | NEW |