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

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

Issue 16320005: Define EncodedVideoSource and RtcCapturedEncodingVideoCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased at 209707. Fix compile warnings. Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
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 // MessageFilter that handles video capture messages and delegates them to 5 // MessageFilter that handles video capture messages and delegates them to
6 // video captures. VideoCaptureMessageFilter is operated on IO thread of 6 // video captures. VideoCaptureMessageFilter is operated on IO thread of
7 // render process. It intercepts video capture messages and process them on 7 // render process. It intercepts video capture messages and process them on
8 // IO thread since these messages are time critical. 8 // IO thread since these messages are time critical.
9 9
10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_ 10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_
11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_ 11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_
12 12
13 #include <map> 13 #include <map>
14 14
15 #include "base/message_loop/message_loop_proxy.h" 15 #include "base/message_loop/message_loop_proxy.h"
16 #include "base/shared_memory.h" 16 #include "base/shared_memory.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/media/video_capture.h" 18 #include "content/common/media/video_capture.h"
19 #include "ipc/ipc_channel_proxy.h" 19 #include "ipc/ipc_channel_proxy.h"
20 #include "media/video/capture/video_capture.h" 20 #include "media/video/capture/video_capture.h"
21 #include "media/video/encoded_video_source.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 class CONTENT_EXPORT VideoCaptureMessageFilter 25 class CONTENT_EXPORT VideoCaptureMessageFilter
25 : public IPC::ChannelProxy::MessageFilter { 26 : public IPC::ChannelProxy::MessageFilter {
26 public: 27 public:
27 class CONTENT_EXPORT Delegate { 28 class CONTENT_EXPORT Delegate {
28 public: 29 public:
29 // Called when a video frame buffer is created in the browser process. 30 // Called when a video frame buffer is created in the browser process.
30 virtual void OnBufferCreated(base::SharedMemoryHandle handle, 31 virtual void OnBufferCreated(base::SharedMemoryHandle handle,
31 int length, int buffer_id) = 0; 32 int length, int buffer_id) = 0;
32 33
33 // Called when a video frame buffer is received from the browser process. 34 // Called when a video frame buffer is received from the browser process.
34 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) = 0; 35 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) = 0;
35 36
36 // Called when state of a video capture device has changed in the browser 37 // Called when state of a video capture device has changed in the browser
37 // process. 38 // process.
38 virtual void OnStateChanged(VideoCaptureState state) = 0; 39 virtual void OnStateChanged(VideoCaptureState state) = 0;
39 40
40 // Called when device info is received from video capture device in the 41 // Called when device info is received from video capture device in the
41 // browser process. 42 // browser process.
42 virtual void OnDeviceInfoReceived( 43 virtual void OnDeviceInfoReceived(
43 const media::VideoCaptureParams& device_info) = 0; 44 const media::VideoCaptureParams& device_info) = 0;
44 45
45 // Called when the delegate has been added to filter's delegate list. 46 // Called when the delegate has been added to filter's delegate list.
46 // |device_id| is the device id for the delegate. 47 // |device_id| is the device id for the delegate.
47 virtual void OnDelegateAdded(int32 device_id) = 0; 48 virtual void OnDelegateAdded(int32 device_id) = 0;
48 49
50 // Called when the encoding capabilities is received from video capture
51 // device in the browser process.
52 virtual void OnEncodingCapabilitiesAvailable(
53 const media::VideoEncodingCapabilities& capabilities) = 0;
54
55 // Called when a bitstream is opened on a video capture device.
56 virtual void OnEncodedBitstreamOpened(
57 const media::VideoEncodingParameters& params,
58 const std::vector<base::SharedMemoryHandle>& buffers,
59 uint32 buffer_size) = 0;
60
61 // Called when a bitstream is closed on a video capture device.
62 virtual void OnEncodedBitstreamClosed() = 0;
63
64 // Called when encoding parameters has changed.
65 virtual void OnEncodingConfigChanged(
66 const media::RuntimeVideoEncodingParameters& params) = 0;
67
68 // Called when an encoded bitstream buffer is received from video capture
69 // device in the browser process.
70 virtual void OnEncodedBufferReady(
71 int buffer_id,
72 uint32 size,
73 const media::BufferEncodingMetadata& metadata) = 0;
74
49 protected: 75 protected:
50 virtual ~Delegate() {} 76 virtual ~Delegate() {}
51 }; 77 };
52 78
53 VideoCaptureMessageFilter(); 79 VideoCaptureMessageFilter();
54 80
55 // Add a delegate to the map. 81 // Add a delegate to the map.
56 void AddDelegate(Delegate* delegate); 82 void AddDelegate(Delegate* delegate);
57 83
58 // Remove a delegate from the map. 84 // Remove a delegate from the map.
(...skipping 26 matching lines...) Expand all
85 void OnBufferReceived(int device_id, 111 void OnBufferReceived(int device_id,
86 int buffer_id, base::Time timestamp); 112 int buffer_id, base::Time timestamp);
87 113
88 // State of browser process' video capture device has changed. 114 // State of browser process' video capture device has changed.
89 void OnDeviceStateChanged(int device_id, VideoCaptureState state); 115 void OnDeviceStateChanged(int device_id, VideoCaptureState state);
90 116
91 // Receive device info from browser process. 117 // Receive device info from browser process.
92 void OnDeviceInfoReceived(int device_id, 118 void OnDeviceInfoReceived(int device_id,
93 const media::VideoCaptureParams& params); 119 const media::VideoCaptureParams& params);
94 120
121 // Receive encoding capabilities from browser process.
122 void OnCapabilitiesAvailable(int device_id,
123 media::VideoEncodingCapabilities capabilities);
124
125 // Bitstream is opened on video capture device.
126 void OnBitstreamOpened(int device_id,
127 media::VideoEncodingParameters params,
128 std::vector<base::SharedMemoryHandle> buffers,
129 uint32 buffer_size);
130
131 // Bitstream is closed on video capture device.
132 void OnBitstreamClosed(int device_id);
133
134 // Receive current encoding parameters from browser process.
135 void OnBitstreamConfigChanged(int device_id,
136 media::RuntimeVideoEncodingParameters params);
137
138 // Receive an encoded bitstream buffer from browser process.
139 void OnBitstreamReady(int device_id, int buffer_id, uint32 size,
140 media::BufferEncodingMetadata metadata);
141
142 // Finds the delegate associated with |device_id|, NULL if not found.
143 Delegate* find_delegate(int device_id) const;
144
95 // A map of device ids to delegates. 145 // A map of device ids to delegates.
96 Delegates delegates_; 146 Delegates delegates_;
97 Delegates pending_delegates_; 147 Delegates pending_delegates_;
98 int32 last_device_id_; 148 int32 last_device_id_;
99 149
100 IPC::Channel* channel_; 150 IPC::Channel* channel_;
101 151
102 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 152 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
103 153
104 DISALLOW_COPY_AND_ASSIGN(VideoCaptureMessageFilter); 154 DISALLOW_COPY_AND_ASSIGN(VideoCaptureMessageFilter);
105 }; 155 };
106 156
107 } // namespace content 157 } // namespace content
108 158
109 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_ 159 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_impl_unittest.cc ('k') | content/renderer/media/video_capture_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698