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

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

Issue 8417019: Simplify VideoDecodeEngine interface by making everything synchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for CaptureVideoDecoder Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/media/capture_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CAPTURE_VIDEO_DECODER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_
6 #define CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ 6 #define CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 26 matching lines...) Expand all
37 virtual void Seek(base::TimeDelta time, 37 virtual void Seek(base::TimeDelta time,
38 const media::FilterStatusCB& cb) OVERRIDE; 38 const media::FilterStatusCB& cb) OVERRIDE;
39 virtual void Pause(const base::Closure& callback) OVERRIDE; 39 virtual void Pause(const base::Closure& callback) OVERRIDE;
40 virtual void Stop(const base::Closure& callback) OVERRIDE; 40 virtual void Stop(const base::Closure& callback) OVERRIDE;
41 41
42 // Decoder implementation. 42 // Decoder implementation.
43 virtual void Initialize( 43 virtual void Initialize(
44 media::DemuxerStream* demuxer_stream, 44 media::DemuxerStream* demuxer_stream,
45 const base::Closure& filter_callback, 45 const base::Closure& filter_callback,
46 const media::StatisticsCallback& stat_callback) OVERRIDE; 46 const media::StatisticsCallback& stat_callback) OVERRIDE;
47 virtual void ProduceVideoFrame( 47 virtual void Read(const ReadCB& callback) OVERRIDE;
48 scoped_refptr<media::VideoFrame> video_frame) OVERRIDE; 48 virtual const gfx::Size& natural_size() OVERRIDE;
49 virtual gfx::Size natural_size() OVERRIDE;
50 49
51 // VideoCapture::EventHandler implementation. 50 // VideoCapture::EventHandler implementation.
52 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE; 51 virtual void OnStarted(media::VideoCapture* capture) OVERRIDE;
53 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE; 52 virtual void OnStopped(media::VideoCapture* capture) OVERRIDE;
54 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE; 53 virtual void OnPaused(media::VideoCapture* capture) OVERRIDE;
55 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE; 54 virtual void OnError(media::VideoCapture* capture, int error_code) OVERRIDE;
56 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE; 55 virtual void OnRemoved(media::VideoCapture* capture) OVERRIDE;
57 virtual void OnBufferReady( 56 virtual void OnBufferReady(
58 media::VideoCapture* capture, 57 media::VideoCapture* capture,
59 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) OVERRIDE; 58 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) OVERRIDE;
60 virtual void OnDeviceInfoReceived( 59 virtual void OnDeviceInfoReceived(
61 media::VideoCapture* capture, 60 media::VideoCapture* capture,
62 const media::VideoCaptureParams& device_info) OVERRIDE; 61 const media::VideoCaptureParams& device_info) OVERRIDE;
63 62
64 private: 63 private:
65 friend class CaptureVideoDecoderTest; 64 friend class CaptureVideoDecoderTest;
66 65
67 enum DecoderState { 66 enum DecoderState {
68 kUnInitialized, 67 kUnInitialized,
69 kNormal, 68 kNormal,
70 kSeeking,
71 kStopped, 69 kStopped,
72 kPaused 70 kPaused
73 }; 71 };
74 72
75 void PlayOnDecoderThread(const base::Closure& callback); 73 void PlayOnDecoderThread(const base::Closure& callback);
76 void SeekOnDecoderThread(base::TimeDelta time, 74 void SeekOnDecoderThread(base::TimeDelta time,
77 const media::FilterStatusCB& cb); 75 const media::FilterStatusCB& cb);
78 void PauseOnDecoderThread(const base::Closure& callback); 76 void PauseOnDecoderThread(const base::Closure& callback);
79 void StopOnDecoderThread(const base::Closure& callback); 77 void StopOnDecoderThread(const base::Closure& callback);
80 78
81 void InitializeOnDecoderThread( 79 void InitializeOnDecoderThread(
82 media::DemuxerStream* demuxer_stream, 80 media::DemuxerStream* demuxer_stream,
83 const base::Closure& filter_callback, 81 const base::Closure& filter_callback,
84 const media::StatisticsCallback& stat_callback); 82 const media::StatisticsCallback& stat_callback);
85 void ProduceVideoFrameOnDecoderThread( 83 void ReadOnDecoderThread(const ReadCB& callback);
86 scoped_refptr<media::VideoFrame> video_frame);
87 84
88 void OnStoppedOnDecoderThread(media::VideoCapture* capture); 85 void OnStoppedOnDecoderThread(media::VideoCapture* capture);
89 void OnBufferReadyOnDecoderThread( 86 void OnBufferReadyOnDecoderThread(
90 media::VideoCapture* capture, 87 media::VideoCapture* capture,
91 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); 88 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf);
92 89
90 // Delivers the frame to |read_cb_| and resets the callback.
91 void DeliverFrame(const scoped_refptr<media::VideoFrame>& video_frame);
92
93 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 93 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
94 scoped_refptr<VideoCaptureImplManager> vc_manager_; 94 scoped_refptr<VideoCaptureImplManager> vc_manager_;
95 media::VideoCapture::VideoCaptureCapability capability_; 95 media::VideoCapture::VideoCaptureCapability capability_;
96 gfx::Size natural_size_;
96 DecoderState state_; 97 DecoderState state_;
97 std::deque<scoped_refptr<media::VideoFrame> > available_frames_; 98 ReadCB read_cb_;
98 base::Closure pending_stop_cb_; 99 base::Closure pending_stop_cb_;
99 media::StatisticsCallback statistics_callback_; 100 media::StatisticsCallback statistics_callback_;
100 101
101 media::VideoCaptureSessionId video_stream_id_; 102 media::VideoCaptureSessionId video_stream_id_;
102 media::VideoCapture* capture_engine_; 103 media::VideoCapture* capture_engine_;
103 base::Time start_time_; 104 base::Time start_time_;
104 105
105 DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder); 106 DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder);
106 }; 107 };
107 108
108 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ 109 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/capture_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698