Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL ER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL ER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL ER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HANDL ER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "mojo/public/cpp/system/buffer.h" | 12 #include "mojo/public/cpp/system/buffer.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 class VideoFrame; | 16 class VideoFrame; |
| 17 } // namespace media | 17 } // namespace media |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 typedef int VideoCaptureControllerID; | 21 typedef int VideoCaptureControllerID; |
| 22 | 22 |
| 23 // VideoCaptureControllerEventHandler is the interface for | 23 // VideoCaptureControllerEventHandler is the interface for |
| 24 // VideoCaptureController to notify clients about the events such as | 24 // VideoCaptureController to notify clients about the events such as |
| 25 // BufferReady, FrameInfo, Error, etc. | 25 // BufferReady, FrameInfo, Error, etc. |
| 26 | |
| 27 // OnStarted can be forwarded directly, while OnError&OnEnded need to be | |
| 28 // scheduled to the end of message queue to guarantee some other clearing | |
| 29 // jobs are done before they are handled. | |
|
chfremer
2017/02/22 19:13:58
directly -> synchronously (to use the more precise
braveyao
2017/02/23 00:06:26
Done.
| |
| 30 | |
| 26 // TODO(mcasas): https://crbug.com/654176 merge back into VideoCaptureController | 31 // TODO(mcasas): https://crbug.com/654176 merge back into VideoCaptureController |
| 27 class CONTENT_EXPORT VideoCaptureControllerEventHandler { | 32 class CONTENT_EXPORT VideoCaptureControllerEventHandler { |
| 28 public: | 33 public: |
| 29 // An Error has occurred in the VideoCaptureDevice. | 34 // An Error has occurred in the VideoCaptureDevice. |
| 30 virtual void OnError(VideoCaptureControllerID id) = 0; | 35 virtual void OnError(VideoCaptureControllerID id) = 0; |
| 31 | 36 |
| 32 // A buffer has been newly created. | 37 // A buffer has been newly created. |
| 33 virtual void OnBufferCreated(VideoCaptureControllerID id, | 38 virtual void OnBufferCreated(VideoCaptureControllerID id, |
| 34 mojo::ScopedSharedBufferHandle handle, | 39 mojo::ScopedSharedBufferHandle handle, |
| 35 int length, | 40 int length, |
| 36 int buffer_id) = 0; | 41 int buffer_id) = 0; |
| 37 | 42 |
| 38 // A previously created buffer has been freed and will no longer be used. | 43 // A previously created buffer has been freed and will no longer be used. |
| 39 virtual void OnBufferDestroyed(VideoCaptureControllerID id, | 44 virtual void OnBufferDestroyed(VideoCaptureControllerID id, |
| 40 int buffer_id) = 0; | 45 int buffer_id) = 0; |
| 41 | 46 |
| 42 // A buffer has been filled with a captured VideoFrame. | 47 // A buffer has been filled with a captured VideoFrame. |
| 43 virtual void OnBufferReady(VideoCaptureControllerID id, | 48 virtual void OnBufferReady(VideoCaptureControllerID id, |
| 44 int buffer_id, | 49 int buffer_id, |
| 45 const scoped_refptr<media::VideoFrame>& frame) = 0; | 50 const scoped_refptr<media::VideoFrame>& frame) = 0; |
| 46 | 51 |
| 47 // The capture session has ended and no more frames will be sent. | 52 // The capture session has ended and no more frames will be sent. |
| 48 virtual void OnEnded(VideoCaptureControllerID id) = 0; | 53 virtual void OnEnded(VideoCaptureControllerID id) = 0; |
| 49 | 54 |
| 55 // VideoCaptureDevice has successfully started the device. | |
| 56 virtual void OnStarted(VideoCaptureControllerID id) = 0; | |
| 57 | |
| 50 protected: | 58 protected: |
| 51 virtual ~VideoCaptureControllerEventHandler() {} | 59 virtual ~VideoCaptureControllerEventHandler() {} |
| 52 }; | 60 }; |
| 53 | 61 |
| 54 } // namespace content | 62 } // namespace content |
| 55 | 63 |
| 56 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA NDLER_H_ | 64 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_VIDEO_CAPTURE_CONTROLLER_EVENT_HA NDLER_H_ |
| OLD | NEW |