summaryrefslogtreecommitdiffstats
path: root/content/common/media
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 08:56:20 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-28 08:56:20 +0000
commitfac792746fd46e9b64aedf45e0094200b8aed9db (patch)
treea48a1a5a708c0eea3cf87c342240e304d8ae9a98 /content/common/media
parent15443b7fa4263b624816023e249814885f1a31ec (diff)
downloadchromium_src-fac792746fd46e9b64aedf45e0094200b8aed9db.zip
chromium_src-fac792746fd46e9b64aedf45e0094200b8aed9db.tar.gz
chromium_src-fac792746fd46e9b64aedf45e0094200b8aed9db.tar.bz2
Refactor video capturing code in the render process
This is a large refactoring to cleanup the code that handles video capturing in the render process. The goal of this change is to: * Simplify threading model for objects involved. * Clarify ownership model. * Remove extra complexity caused by media::VideoCapture. Summary of this change: * Interface media::VideoCapture is removed completely. This interface doesn't add much value. It fails to define threading model and ownership. Some of the methods are obsolete. * Pepper code that performs video capturing now do not inherit from media::VideoCapture. The inheritance is not necessary * VideoCaptureImpl is now a purely IO thread object. VideoCaptureImpl can only be accessed on the IO thread. It now becomes and inner object of VideoCaptureImplManager. Client is not allowed to access this object directly. This helps remove code that accepts call from the render thread and hopping to the IO thread. This also makes cleanup much simpler. * VideoCaptureHandle is removed. The function of VideoCaptureHandle, i.e. handle cleanup of video capture resource is now folded into VideoCaptureImplManager. It's function is now replaced by a closure. * VideoCaptureImplManager becomes the public interface for accessing video capture device and start/stop capture. It takes VideoCaptureImpl as an internal object and sheild it from clients. We can now perform cleanup to prevent leak. Also ensures VideoCaptureImpl objects are deleted on the IO thread. * VideoFrames delivery done using callback insteasd of an interface. Using callback to deliver VideoFrames and state changes make thread hopping much simpler. Clients no longer need to provide an EventHandler interface. * Net deleted 450 lines of code. Tested with apprtc.appspot.com and example pepper plugin. Additional test to verify there's no leakage of VideoCaptureImpl objects. BUG=335327, 362558 Review URL: https://codereview.chromium.org/242013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266492 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/media')
-rw-r--r--content/common/media/video_capture.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/content/common/media/video_capture.h b/content/common/media/video_capture.h
index 5c6384e..bf43ebb 100644
--- a/content/common/media/video_capture.h
+++ b/content/common/media/video_capture.h
@@ -7,6 +7,10 @@
#ifndef CONTENT_COMMON_MEDIA_VIDEO_CAPTURE_H_
#define CONTENT_COMMON_MEDIA_VIDEO_CAPTURE_H_
+#include "base/time/time.h"
+#include "media/base/video_frame.h"
+#include "media/video/capture/video_capture_types.h"
+
namespace content {
// Current status of the video capture device. It's used by multiple classes
@@ -24,6 +28,15 @@ enum VideoCaptureState {
VIDEO_CAPTURE_STATE_LAST = VIDEO_CAPTURE_STATE_ENDED
};
+typedef base::Callback<void(VideoCaptureState)>
+ VideoCaptureStateUpdateCB;
+typedef base::Callback<void(const media::VideoCaptureFormats&)>
+ VideoCaptureDeviceFormatsCB;
+typedef base::Callback<
+ void(const scoped_refptr<media::VideoFrame>&,
+ const media::VideoCaptureFormat&)>
+ VideoCaptureDeliverFrameCB;
+
} // namespace content
#endif // CONTENT_COMMON_MEDIA_VIDEO_CAPTURE_H_