| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 base::TaskRunner* main_thread, // For accessing VideoTracks. | 37 base::TaskRunner* main_thread, // For accessing VideoTracks. |
| 38 webrtc::VideoTrackInterface* video_track); | 38 webrtc::VideoTrackInterface* video_track); |
| 39 | 39 |
| 40 // media::VideoDecoder implementation. | 40 // media::VideoDecoder implementation. |
| 41 virtual void Initialize(const scoped_refptr<media::DemuxerStream>& stream, | 41 virtual void Initialize(const scoped_refptr<media::DemuxerStream>& stream, |
| 42 const media::PipelineStatusCB& status_cb, | 42 const media::PipelineStatusCB& status_cb, |
| 43 const media::StatisticsCB& statistics_cb) OVERRIDE; | 43 const media::StatisticsCB& statistics_cb) OVERRIDE; |
| 44 virtual void Read(const ReadCB& read_cb) OVERRIDE; | 44 virtual void Read(const ReadCB& read_cb) OVERRIDE; |
| 45 virtual void Reset(const base::Closure& closure) OVERRIDE; | 45 virtual void Reset(const base::Closure& closure) OVERRIDE; |
| 46 virtual void Stop(const base::Closure& closure) OVERRIDE; | 46 virtual void Stop(const base::Closure& closure) OVERRIDE; |
| 47 virtual void PrepareForShutdownHack() OVERRIDE; | |
| 48 | 47 |
| 49 // webrtc::VideoRendererInterface implementation | 48 // webrtc::VideoRendererInterface implementation |
| 50 virtual void SetSize(int width, int height) OVERRIDE; | 49 virtual void SetSize(int width, int height) OVERRIDE; |
| 51 virtual void RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; | 50 virtual void RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; |
| 52 | 51 |
| 53 protected: | 52 protected: |
| 54 virtual ~RTCVideoDecoder(); | 53 virtual ~RTCVideoDecoder(); |
| 55 | 54 |
| 56 private: | 55 private: |
| 57 friend class RTCVideoDecoderTest; | 56 friend class RTCVideoDecoderTest; |
| 58 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful); | 57 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful); |
| 59 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoReset); | 58 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoReset); |
| 60 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoRenderFrame); | 59 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoRenderFrame); |
| 61 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSetSize); | 60 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSetSize); |
| 62 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, ReadAndShutdown); | |
| 63 | 61 |
| 64 enum DecoderState { | 62 enum DecoderState { |
| 65 kUnInitialized, | 63 kUnInitialized, |
| 66 kNormal, | 64 kNormal, |
| 67 kStopped | 65 kStopped |
| 68 }; | 66 }; |
| 69 | 67 |
| 70 void CancelPendingRead(); | 68 void CancelPendingRead(); |
| 71 | 69 |
| 72 // Register this RTCVideoDecoder to get VideoFrames from the | 70 // Register this RTCVideoDecoder to get VideoFrames from the |
| 73 // webrtc::VideoTrack in |video_track_|. | 71 // webrtc::VideoTrack in |video_track_|. |
| 74 // This is done on the |main_thread_|. | 72 // This is done on the |main_thread_|. |
| 75 void RegisterToVideoTrack(); | 73 void RegisterToVideoTrack(); |
| 76 void DeregisterFromVideoTrack(); | 74 void DeregisterFromVideoTrack(); |
| 77 | 75 |
| 78 scoped_refptr<base::TaskRunner> video_decoder_thread_; | 76 scoped_refptr<base::TaskRunner> video_decoder_thread_; |
| 79 scoped_refptr<base::TaskRunner> main_thread_; | 77 scoped_refptr<base::TaskRunner> main_thread_; |
| 80 gfx::Size visible_size_; | 78 gfx::Size visible_size_; |
| 81 std::string url_; | 79 std::string url_; |
| 82 DecoderState state_; | 80 DecoderState state_; |
| 83 ReadCB read_cb_; | 81 ReadCB read_cb_; |
| 84 bool got_first_frame_; | 82 bool got_first_frame_; |
| 85 bool shutting_down_; | |
| 86 base::TimeDelta last_frame_timestamp_; | 83 base::TimeDelta last_frame_timestamp_; |
| 87 base::TimeDelta start_time_; | 84 base::TimeDelta start_time_; |
| 88 // The video track the renderer is connected to. | 85 // The video track the renderer is connected to. |
| 89 scoped_refptr<webrtc::VideoTrackInterface> video_track_; | 86 scoped_refptr<webrtc::VideoTrackInterface> video_track_; |
| 90 | 87 |
| 91 // Used for accessing |read_cb_| from another thread. | 88 // Used for accessing |read_cb_| from another thread. |
| 92 base::Lock lock_; | 89 base::Lock lock_; |
| 93 | 90 |
| 94 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); | 91 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); |
| 95 }; | 92 }; |
| 96 | 93 |
| 97 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ | 94 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_ |
| OLD | NEW |