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