Chromium Code Reviews| Index: content/renderer/media/captured_encoded_video_source_impl.h |
| diff --git a/content/renderer/media/captured_encoded_video_source_impl.h b/content/renderer/media/captured_encoded_video_source_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..aa6d70e006e4f2f6c757968102ef15a934cd5a23 |
| --- /dev/null |
| +++ b/content/renderer/media/captured_encoded_video_source_impl.h |
| @@ -0,0 +1,142 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +#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
|
| +#define CONTENT_RENDERER_MEDIA_CAPTURED_ENCODED_VIDEO_SOURCE_IMPL_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/observer_list_threadsafe.h" |
| +#include "content/common/content_export.h" |
| +#include "content/renderer/media/encoding_video_capture_message_filter.h" |
| +#include "media/video/encoded_video_source.h" |
| + |
| +namespace base { |
| +class MessageLoopProxy; |
| +} // base |
| + |
| +namespace IPC { |
| +class Message; |
| +class Sender; |
| +} // IPC |
| + |
| +namespace content { |
| + |
| +class CapturedEncodedVideoSourceImpl; |
| + |
| +// Class implementing encoded video bitstream functionality for a video capture |
| +// 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).
|
| +// between capture and IO threads of Renderer process. |
| +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).
|
| + public media::EncodedVideoBitstream { |
| + public: |
| + 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).
|
| + CapturedEncodedVideoSourceImpl* source, |
| + media::EncodedVideoBitstream::Client* client); |
| + |
| + // media::EncodedVideoBitstream implementation. |
| + virtual void TryConfigure( |
| + const media::RuntimeVideoEncodingParameters& params) OVERRIDE; |
| + |
| + // Functions to trigger bitstream event notifications to client. |
| + void NotifyStreaming( |
| + const media::VideoEncodingParameters& params, |
| + const std::map<int, base::SharedMemoryHandle>& buffers); |
| + void NotifyRemoved(); |
| + void NotifyConfigChanged(const media::RuntimeVideoEncodingParameters& params); |
| + void NotifyBitstreamReady( |
| + int buffer_id, |
| + size_t size, |
| + const media::BufferEncodingMetadata& metadata); |
| + |
| + protected: |
| + virtual ~CapturedEncodedVideoBitstreamImpl(); |
| + |
| + private: |
| + CapturedEncodedVideoSourceImpl* source_; |
| + media::EncodedVideoBitstream::Client* client_; |
| + std::map<int, base::SharedMemory*> buffers_; |
| +}; |
| + |
| +// Class implementing encoded video source functionality for a video capture |
| +// device. It lives in similar setting where it is proxying communication |
| +// between capture and IO threads of Renderer process. In addition it manages |
| +// the CapturedEncodedVideoBitstreamImpl objects and relays the communication |
| +// needed by them. |
| +class CONTENT_EXPORT CapturedEncodedVideoSourceImpl : |
| + public media::EncodedVideoSource, |
| + public EncodingVideoCaptureMessageFilter::Delegate { |
| + public: |
| + CapturedEncodedVideoSourceImpl(); |
| + virtual ~CapturedEncodedVideoSourceImpl(); |
| + |
| + // media::EncoderVideoSource implementation which is the public interface |
| + // towards the clients of this class. |
| + virtual void AddCapabilitiesObserver(Observer* observer) OVERRIDE; |
| + virtual void RemoveCapabilitiesObserver(Observer* observer) OVERRIDE; |
| + virtual void StartFetchCapabilities() OVERRIDE; |
| + virtual media::VideoEncodingCapability GetCapabilities() OVERRIDE; |
| + virtual scoped_refptr<media::EncodedVideoBitstream> OpenBitstream( |
| + media::EncodedVideoBitstream::Client* client, |
| + const media::VideoEncodingParameters& params) OVERRIDE; |
| + virtual void CloseBitstream( |
| + scoped_refptr<media::EncodedVideoBitstream> bitstream) OVERRIDE; |
| + virtual void ReturnBitstreamBuffer( |
| + scoped_refptr<media::EncodedVideoBitstream> bitstream, |
| + scoped_refptr<const media::EncodedBitstreamBuffer> buffer) OVERRIDE; |
| + |
| + // EncodingVideoCaptureMessageFilter::Delegate implementation. |
| + virtual void OnCapabilityAvailable( |
| + const media::VideoEncodingCapability& capability) OVERRIDE; |
| + virtual void OnBitstreamCreated( |
| + int stream_id, |
| + const media::VideoEncodingParameters& params, |
| + const std::map<int, base::SharedMemoryHandle>& buffers) OVERRIDE; |
| + virtual void OnBitstreamDestroyed(int stream_id) OVERRIDE; |
| + virtual void OnBitstreamConfigChanged( |
| + int stream_id, |
| + const media::RuntimeVideoEncodingParameters& params) OVERRIDE; |
| + virtual void OnBitstreamReady( |
| + int stream_id, |
| + int buffer_id, |
| + size_t size, |
| + const media::BufferEncodingMetadata& metadata) OVERRIDE; |
| + |
| + // Functionality exposed to CapturedEncodedVideoBitstreamImpl. |
| + void TrySetBitstreamConfig( |
| + scoped_refptr<CapturedEncodedVideoBitstreamImpl> bitstream, |
| + const media::RuntimeVideoEncodingParameters& params); |
| + |
| + protected: |
| + // 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.
|
| + virtual void Send(IPC::Message* message) = 0; |
| + virtual int device_id() = 0; |
| + 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.
|
| + 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.
|
| + void set_encoding_capabilities(media::VideoEncodingCapability caps) { |
| + capability_ = caps; |
| + } |
| + |
| + private: |
| + // Helpers to find the bitstreams and ids. |
| + scoped_refptr<CapturedEncodedVideoBitstreamImpl> FindBitstream(int stream_id); |
| + int FindStreamId(scoped_refptr<media::EncodedVideoBitstream> bitstream); |
| + // Function to send messages to IO thread. |
| + void SendToIo(IPC::Message* message); |
| + // Video encoding capability as reported by the device. |
| + media::VideoEncodingCapability capability_; |
| + // Map for our bitstreams with stream_id as the key and corresponding |
| + // bitstream as the value. |
| + std::map<int, scoped_refptr<CapturedEncodedVideoBitstreamImpl> > bitstreams_; |
| + // Running stream index. |
| + int stream_index_; |
| + |
| + ObserverList<media::EncodedVideoSource::Observer, true> |
| + capabilities_observers_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_CAPTURED_ENCODED_VIDEO_SOURCE_IMPL_H_ |
| + |