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

Side by Side Diff: content/renderer/media/rtc_video_decoder.h

Issue 12320078: Delete old RTCVideoDecoder code path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make the line no longer than 80 chars Created 7 years, 9 months 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
7
8 #include <string>
9
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/synchronization/lock.h"
13 #include "base/task_runner.h"
14 #include "base/time.h"
15 #include "content/common/content_export.h"
16 #include "media/base/video_decoder.h"
17 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
18
19
20 namespace cricket {
21 class VideoFrame;
22 } // namespace cricket
23
24 namespace content {
25
26 // RTCVideoDecoder is a media::VideoDecoder designed for rendering
27 // Video MediaStreamTracks,
28 // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#mediastreamtrack
29 // RTCVideoDecoder implements webrtc::VideoRendererInterface in order to render
30 // video frames provided from a webrtc::VideoTrackInteface.
31 // RTCVideoDecoder register itself to the Video Track when the decoder is
32 // initialized and deregisters itself when it is stopped.
33 // Calls to webrtc::VideoTrackInterface must occur on the main render thread.
34 class CONTENT_EXPORT RTCVideoDecoder
35 : public media::VideoDecoder,
36 NON_EXPORTED_BASE(public webrtc::VideoRendererInterface) {
37 public:
38 RTCVideoDecoder(base::TaskRunner* video_decoder_thread, // For video decoder
39 base::TaskRunner* main_thread, // For accessing VideoTracks.
40 webrtc::VideoTrackInterface* video_track);
41
42 // media::VideoDecoder implementation.
43 virtual void Initialize(const scoped_refptr<media::DemuxerStream>& stream,
44 const media::PipelineStatusCB& status_cb,
45 const media::StatisticsCB& statistics_cb) OVERRIDE;
46 virtual void Read(const ReadCB& read_cb) OVERRIDE;
47 virtual void Reset(const base::Closure& closure) OVERRIDE;
48 virtual void Stop(const base::Closure& closure) OVERRIDE;
49
50 // webrtc::VideoRendererInterface implementation
51 virtual void SetSize(int width, int height) OVERRIDE;
52 virtual void RenderFrame(const cricket::VideoFrame* frame) OVERRIDE;
53
54 protected:
55 virtual ~RTCVideoDecoder();
56
57 private:
58 friend class RTCVideoDecoderTest;
59 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful);
60 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoReset);
61 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoRenderFrame);
62 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSetSize);
63
64 enum DecoderState {
65 kUnInitialized,
66 kNormal,
67 kStopped
68 };
69
70 void CancelPendingRead();
71
72 // Register this RTCVideoDecoder to get VideoFrames from the
73 // webrtc::VideoTrack in |video_track_|.
74 // This is done on the |main_thread_|.
75 void RegisterToVideoTrack();
76 void DeregisterFromVideoTrack();
77
78 scoped_refptr<base::TaskRunner> video_decoder_thread_;
79 scoped_refptr<base::TaskRunner> main_thread_;
80 gfx::Size visible_size_;
81 std::string url_;
82 DecoderState state_;
83 ReadCB read_cb_;
84 bool got_first_frame_;
85 base::TimeDelta last_frame_timestamp_;
86 base::TimeDelta start_time_;
87 // The video track the renderer is connected to.
88 scoped_refptr<webrtc::VideoTrackInterface> video_track_;
89
90 // Used for accessing |read_cb_| from another thread.
91 base::Lock lock_;
92
93 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder);
94 };
95
96 } // namespace content
97
98 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_impl_unittest.cc ('k') | content/renderer/media/rtc_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698