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

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

Issue 955253002: Add metadata to media::VideoFrame and plumb it through IPC/MediaStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tommi's nits addressed Created 5 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
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/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/values.h"
16 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
17 #include "content/common/media/video_capture.h" 18 #include "content/common/media/video_capture.h"
18 #include "ipc/message_filter.h" 19 #include "ipc/message_filter.h"
19 #include "media/base/video_capture_types.h" 20 #include "media/base/video_capture_types.h"
20 21
22 struct VideoCaptureMsg_BufferReady_Params;
23 struct VideoCaptureMsg_MailboxBufferReady_Params;
24
21 namespace gpu { 25 namespace gpu {
22 struct MailboxHolder; 26 struct MailboxHolder;
23 } // namespace gpu 27 } // namespace gpu
24 28
25 namespace content { 29 namespace content {
26 30
27 class CONTENT_EXPORT VideoCaptureMessageFilter : public IPC::MessageFilter { 31 class CONTENT_EXPORT VideoCaptureMessageFilter : public IPC::MessageFilter {
28 public: 32 public:
29 class CONTENT_EXPORT Delegate { 33 class CONTENT_EXPORT Delegate {
30 public: 34 public:
31 // Called when a video frame buffer is created in the browser process. 35 // Called when a video frame buffer is created in the browser process.
32 virtual void OnBufferCreated(base::SharedMemoryHandle handle, 36 virtual void OnBufferCreated(base::SharedMemoryHandle handle,
33 int length, 37 int length,
34 int buffer_id) = 0; 38 int buffer_id) = 0;
35 39
36 virtual void OnBufferDestroyed(int buffer_id) = 0; 40 virtual void OnBufferDestroyed(int buffer_id) = 0;
37 41
38 // Called when a video frame buffer is received from the browser process. 42 // Called when a video frame buffer is received from the browser process.
39 virtual void OnBufferReceived(int buffer_id, 43 virtual void OnBufferReceived(
40 const media::VideoCaptureFormat& format, 44 int buffer_id,
41 const gfx::Rect& visible_rect, 45 const gfx::Size& coded_size,
42 base::TimeTicks timestamp) = 0; 46 const gfx::Rect& visible_rect,
47 base::TimeTicks timestamp,
48 const base::DictionaryValue& metadata) = 0;
43 49
44 // Called when a video mailbox buffer is received from the browser process. 50 // Called when a video mailbox buffer is received from the browser process.
45 virtual void OnMailboxBufferReceived( 51 virtual void OnMailboxBufferReceived(
46 int buffer_id, 52 int buffer_id,
47 const gpu::MailboxHolder& mailbox_holder, 53 const gpu::MailboxHolder& mailbox_holder,
48 const media::VideoCaptureFormat& format, 54 const gfx::Size& packed_frame_size,
49 base::TimeTicks timestamp) = 0; 55 base::TimeTicks timestamp,
56 const base::DictionaryValue& metadata) = 0;
50 57
51 // Called when state of a video capture device has changed in the browser 58 // Called when state of a video capture device has changed in the browser
52 // process. 59 // process.
53 virtual void OnStateChanged(VideoCaptureState state) = 0; 60 virtual void OnStateChanged(VideoCaptureState state) = 0;
54 61
55 // Called upon reception of device's supported formats back from browser. 62 // Called upon reception of device's supported formats back from browser.
56 virtual void OnDeviceSupportedFormatsEnumerated( 63 virtual void OnDeviceSupportedFormatsEnumerated(
57 const media::VideoCaptureFormats& supported_formats) = 0; 64 const media::VideoCaptureFormats& supported_formats) = 0;
58 65
59 // Called upon reception of format(s) in use by a device back from browser. 66 // Called upon reception of format(s) in use by a device back from browser.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void OnBufferCreated(int device_id, 102 void OnBufferCreated(int device_id,
96 base::SharedMemoryHandle handle, 103 base::SharedMemoryHandle handle,
97 int length, 104 int length,
98 int buffer_id); 105 int buffer_id);
99 106
100 // Release a buffer received by OnBufferCreated. 107 // Release a buffer received by OnBufferCreated.
101 void OnBufferDestroyed(int device_id, 108 void OnBufferDestroyed(int device_id,
102 int buffer_id); 109 int buffer_id);
103 110
104 // Receive a filled buffer from browser process. 111 // Receive a filled buffer from browser process.
105 void OnBufferReceived(int device_id, 112 void OnBufferReceived(const VideoCaptureMsg_BufferReady_Params& params);
106 int buffer_id,
107 const media::VideoCaptureFormat& format,
108 const gfx::Rect& visible_rect,
109 base::TimeTicks timestamp);
110 113
111 // Receive a filled texture mailbox buffer from browser process. 114 // Receive a filled texture mailbox buffer from browser process.
112 void OnMailboxBufferReceived(int device_id, 115 void OnMailboxBufferReceived(
113 int buffer_id, 116 const VideoCaptureMsg_MailboxBufferReady_Params& params);
114 const gpu::MailboxHolder& mailbox_holder,
115 const media::VideoCaptureFormat& format,
116 base::TimeTicks timestamp);
117 117
118 // State of browser process' video capture device has changed. 118 // State of browser process' video capture device has changed.
119 void OnDeviceStateChanged(int device_id, VideoCaptureState state); 119 void OnDeviceStateChanged(int device_id, VideoCaptureState state);
120 120
121 // Receive a device's supported formats back from browser process. 121 // Receive a device's supported formats back from browser process.
122 void OnDeviceSupportedFormatsEnumerated( 122 void OnDeviceSupportedFormatsEnumerated(
123 int device_id, 123 int device_id,
124 const media::VideoCaptureFormats& supported_formats); 124 const media::VideoCaptureFormats& supported_formats);
125 125
126 // Receive the formats in-use by a device back from browser process. 126 // Receive the formats in-use by a device back from browser process.
(...skipping 10 matching lines...) Expand all
137 int32 last_device_id_; 137 int32 last_device_id_;
138 138
139 IPC::Sender* sender_; 139 IPC::Sender* sender_;
140 140
141 DISALLOW_COPY_AND_ASSIGN(VideoCaptureMessageFilter); 141 DISALLOW_COPY_AND_ASSIGN(VideoCaptureMessageFilter);
142 }; 142 };
143 143
144 } // namespace content 144 } // namespace content
145 145
146 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_MESSAGE_FILTER_H_ 146 #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