OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 #ifndef CONTENT_RENDERER_MEDIA_CAPTURED_ENCODED_VIDEO_SOURCE_IMPL_H_ | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
I _think_ you can actually drop this file (and it'
hshi1
2013/06/11 19:51:22
I'm removing the entire file and moved EVS stuff t
| |
5 #define CONTENT_RENDERER_MEDIA_CAPTURED_ENCODED_VIDEO_SOURCE_IMPL_H_ | |
6 | |
7 #include <map> | |
8 | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/observer_list_threadsafe.h" | |
11 #include "content/common/content_export.h" | |
12 #include "content/renderer/media/encoding_video_capture_message_filter.h" | |
13 #include "media/video/encoded_video_source.h" | |
14 | |
15 namespace base { | |
16 class MessageLoopProxy; | |
17 } // base | |
18 | |
19 namespace IPC { | |
20 class Message; | |
21 class Sender; | |
22 } // IPC | |
23 | |
24 namespace content { | |
25 | |
26 class CapturedEncodedVideoSourceImpl; | |
27 | |
28 // Class implementing encoded video bitstream functionality for a video capture | |
29 // device. It lives in similar setting where it is proxying communication | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
"similar" to what?
hshi1
2013/06/11 19:51:22
N/A (this class is removed).
| |
30 // between capture and IO threads of Renderer process. | |
31 class CONTENT_EXPORT CapturedEncodedVideoBitstreamImpl : | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
Seems like an impl detail of CEVSI below; make it
hshi1
2013/06/11 19:51:22
N/A (this class is removed).
| |
32 public media::EncodedVideoBitstream { | |
33 public: | |
34 CapturedEncodedVideoBitstreamImpl( | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
doco lifecycle of args
hshi1
2013/06/11 19:51:22
N/A (this class is removed).
| |
35 CapturedEncodedVideoSourceImpl* source, | |
36 media::EncodedVideoBitstream::Client* client); | |
37 | |
38 // media::EncodedVideoBitstream implementation. | |
39 virtual void TryConfigure( | |
40 const media::RuntimeVideoEncodingParameters& params) OVERRIDE; | |
41 | |
42 // Functions to trigger bitstream event notifications to client. | |
43 void NotifyStreaming( | |
44 const media::VideoEncodingParameters& params, | |
45 const std::map<int, base::SharedMemoryHandle>& buffers); | |
46 void NotifyRemoved(); | |
47 void NotifyConfigChanged(const media::RuntimeVideoEncodingParameters& params); | |
48 void NotifyBitstreamReady( | |
49 int buffer_id, | |
50 size_t size, | |
51 const media::BufferEncodingMetadata& metadata); | |
52 | |
53 protected: | |
54 virtual ~CapturedEncodedVideoBitstreamImpl(); | |
55 | |
56 private: | |
57 CapturedEncodedVideoSourceImpl* source_; | |
58 media::EncodedVideoBitstream::Client* client_; | |
59 std::map<int, base::SharedMemory*> buffers_; | |
60 }; | |
61 | |
62 // Class implementing encoded video source functionality for a video capture | |
63 // device. It lives in similar setting where it is proxying communication | |
64 // between capture and IO threads of Renderer process. In addition it manages | |
65 // the CapturedEncodedVideoBitstreamImpl objects and relays the communication | |
66 // needed by them. | |
67 class CONTENT_EXPORT CapturedEncodedVideoSourceImpl : | |
68 public media::EncodedVideoSource, | |
69 public EncodingVideoCaptureMessageFilter::Delegate { | |
70 public: | |
71 CapturedEncodedVideoSourceImpl(); | |
72 virtual ~CapturedEncodedVideoSourceImpl(); | |
73 | |
74 // media::EncoderVideoSource implementation which is the public interface | |
75 // towards the clients of this class. | |
76 virtual void AddCapabilitiesObserver(Observer* observer) OVERRIDE; | |
77 virtual void RemoveCapabilitiesObserver(Observer* observer) OVERRIDE; | |
78 virtual void StartFetchCapabilities() OVERRIDE; | |
79 virtual media::VideoEncodingCapability GetCapabilities() OVERRIDE; | |
80 virtual scoped_refptr<media::EncodedVideoBitstream> OpenBitstream( | |
81 media::EncodedVideoBitstream::Client* client, | |
82 const media::VideoEncodingParameters& params) OVERRIDE; | |
83 virtual void CloseBitstream( | |
84 scoped_refptr<media::EncodedVideoBitstream> bitstream) OVERRIDE; | |
85 virtual void ReturnBitstreamBuffer( | |
86 scoped_refptr<media::EncodedVideoBitstream> bitstream, | |
87 scoped_refptr<const media::EncodedBitstreamBuffer> buffer) OVERRIDE; | |
88 | |
89 // EncodingVideoCaptureMessageFilter::Delegate implementation. | |
90 virtual void OnCapabilityAvailable( | |
91 const media::VideoEncodingCapability& capability) OVERRIDE; | |
92 virtual void OnBitstreamCreated( | |
93 int stream_id, | |
94 const media::VideoEncodingParameters& params, | |
95 const std::map<int, base::SharedMemoryHandle>& buffers) OVERRIDE; | |
96 virtual void OnBitstreamDestroyed(int stream_id) OVERRIDE; | |
97 virtual void OnBitstreamConfigChanged( | |
98 int stream_id, | |
99 const media::RuntimeVideoEncodingParameters& params) OVERRIDE; | |
100 virtual void OnBitstreamReady( | |
101 int stream_id, | |
102 int buffer_id, | |
103 size_t size, | |
104 const media::BufferEncodingMetadata& metadata) OVERRIDE; | |
105 | |
106 // Functionality exposed to CapturedEncodedVideoBitstreamImpl. | |
107 void TrySetBitstreamConfig( | |
108 scoped_refptr<CapturedEncodedVideoBitstreamImpl> bitstream, | |
109 const media::RuntimeVideoEncodingParameters& params); | |
110 | |
111 protected: | |
112 // Services required from deriving class. | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
You need to say what these methods are supposed to
hshi1
2013/06/11 19:51:22
Removed this indirection.
| |
113 virtual void Send(IPC::Message* message) = 0; | |
114 virtual int device_id() = 0; | |
115 virtual scoped_refptr<base::MessageLoopProxy> app_loop_proxy() = 0; | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
What is "app" in this context?
hshi1
2013/06/11 19:51:22
Removed.
| |
116 virtual scoped_refptr<base::MessageLoopProxy> io_loop_proxy() = 0; | |
Ami GONE FROM CHROMIUM
2013/06/08 00:18:01
This is always
ChildProcess::current()->io_message
hshi1
2013/06/11 19:51:22
Removed.
| |
117 void set_encoding_capabilities(media::VideoEncodingCapability caps) { | |
118 capability_ = caps; | |
119 } | |
120 | |
121 private: | |
122 // Helpers to find the bitstreams and ids. | |
123 scoped_refptr<CapturedEncodedVideoBitstreamImpl> FindBitstream(int stream_id); | |
124 int FindStreamId(scoped_refptr<media::EncodedVideoBitstream> bitstream); | |
125 // Function to send messages to IO thread. | |
126 void SendToIo(IPC::Message* message); | |
127 // Video encoding capability as reported by the device. | |
128 media::VideoEncodingCapability capability_; | |
129 // Map for our bitstreams with stream_id as the key and corresponding | |
130 // bitstream as the value. | |
131 std::map<int, scoped_refptr<CapturedEncodedVideoBitstreamImpl> > bitstreams_; | |
132 // Running stream index. | |
133 int stream_index_; | |
134 | |
135 ObserverList<media::EncodedVideoSource::Observer, true> | |
136 capabilities_observers_; | |
137 }; | |
138 | |
139 } // namespace content | |
140 | |
141 #endif // CONTENT_RENDERER_MEDIA_CAPTURED_ENCODED_VIDEO_SOURCE_IMPL_H_ | |
142 | |
OLD | NEW |