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

Unified Diff: content/browser/renderer_host/media/video_capture_controller.h

Issue 15906019: Hook up EncodedVideoSource on the browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_cl_6
Patch Set: 516738a8 IPC/struct changes, courtesy hshi@ Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_controller.h
diff --git a/content/browser/renderer_host/media/video_capture_controller.h b/content/browser/renderer_host/media/video_capture_controller.h
index 091b87dc87929f9c048b92d49921e281bc3591ea..cb8babf091167f8b539be2a3a079d3ac47b73afb 100644
--- a/content/browser/renderer_host/media/video_capture_controller.h
+++ b/content/browser/renderer_host/media/video_capture_controller.h
@@ -30,6 +30,7 @@
#include "media/video/capture/video_capture.h"
#include "media/video/capture/video_capture_device.h"
#include "media/video/capture/video_capture_types.h"
+#include "media/video/video_encode_types.h"
namespace content {
class VideoCaptureManager;
@@ -67,8 +68,15 @@ class CONTENT_EXPORT VideoCaptureController
VideoCaptureControllerEventHandler* event_handler,
int buffer_id);
+ // Attempt to configure the encoding parameters for an encoded bitstream.
+ // Fails silently if the capture device does not support encoding.
+ void TryConfigureEncodedBitstream(
+ const media::RuntimeVideoEncodingParameters& params);
+
// Implement media::VideoCaptureDevice::EventHandler.
- virtual scoped_refptr<media::VideoFrame> ReserveOutputBuffer() OVERRIDE;
+ virtual scoped_refptr<media::VideoFrame> ReserveOutputVideoFrame() OVERRIDE;
+ virtual scoped_refptr<media::EncodedBitstreamBuffer>
+ ReserveOutputEncodedBitstreamBuffer() OVERRIDE;
virtual void OnIncomingCapturedFrame(const uint8* data,
int length,
base::Time timestamp,
@@ -78,14 +86,26 @@ class CONTENT_EXPORT VideoCaptureController
virtual void OnIncomingCapturedVideoFrame(
const scoped_refptr<media::VideoFrame>& frame,
base::Time timestamp) OVERRIDE;
+ virtual void OnIncomingCapturedEncodedBitstreamBuffer(
+ const scoped_refptr<media::EncodedBitstreamBuffer>& buffer,
+ size_t data_size,
+ base::Time timestamp) OVERRIDE;
virtual void OnError() OVERRIDE;
virtual void OnFrameInfo(
const media::VideoCaptureCapability& info) OVERRIDE;
+ virtual void OnEncodedFrameInfo(
+ const media::VideoEncodingParameters& info) OVERRIDE;
+ virtual void OnBitstreamConfigChanged(
+ const media::RuntimeVideoEncodingParameters& params) OVERRIDE;
// Reserve a media::VideoFrame in I420 format from a buffer pool.
static scoped_refptr<media::VideoFrame> ReserveI420VideoFrame(
VideoCaptureBufferPool* buffer_pool, const gfx::Size& size);
+ // Reserve a media::EncodedBitstreaBuffer from a buffer pool.
+ static scoped_refptr<media::EncodedBitstreamBuffer>
+ ReserveEncodedBitstreamBuffer(VideoCaptureBufferPool* buffer_pool);
+
protected:
virtual ~VideoCaptureController();
@@ -99,10 +119,20 @@ class CONTENT_EXPORT VideoCaptureController
void OnDeviceStopped();
// Worker functions on IO thread.
- void DoIncomingCapturedFrameOnIOThread(
- const scoped_refptr<media::VideoFrame>& captured_frame,
+ void DoIncomingCapturedVideoFrameOnIOThread(
+ const scoped_refptr<media::VideoFrame>& frame,
+ base::Time timestamp);
+ void DoIncomingCapturedEncodedBitstreamBufferOnIOThread(
+ const scoped_refptr<media::EncodedBitstreamBuffer>& buffer,
+ size_t data_size,
+ base::Time timestamp);
+ void DoIncomingCapturedSharedMemoryOnIOThread(
+ base::SharedMemoryHandle reserved_handle,
+ size_t data_size,
base::Time timestamp);
- void DoFrameInfoOnIOThread();
+ void DoFrameInfoOnIOThread(bool encoded);
+ void DoBitstreamConfigChangedOnIOThread(
+ const media::RuntimeVideoEncodingParameters& params);
void DoErrorOnIOThread();
void DoDeviceStoppedOnIOThread();
@@ -143,6 +173,7 @@ class CONTENT_EXPORT VideoCaptureController
// It's modified on caller thread, assuming there is only one OnFrameInfo()
// call per StartCapture().
media::VideoCaptureCapability frame_info_;
+ media::VideoEncodingParameters encoded_frame_info_;
// Chopped pixels in width/height in case video capture device has odd numbers
// for width/height.
@@ -151,6 +182,7 @@ class CONTENT_EXPORT VideoCaptureController
// It's accessed only on IO thread.
bool frame_info_available_;
+ bool encoded_frame_info_available_;
VideoCaptureManager* video_capture_manager_;

Powered by Google App Engine
This is Rietveld 408576698