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

Unified Diff: content/renderer/media/media_stream_video_capturer_source.h

Issue 295483002: Make sure ReadyStateEnded is fired when video stream stops (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/renderer/media/media_stream_video_capturer_source.h
diff --git a/content/renderer/media/media_stream_video_capturer_source.h b/content/renderer/media/media_stream_video_capturer_source.h
index dcae91a7ebc6fdb81bec7383d3e2505772db26d7..dcffa02d371aca9dcd137b1a8370a659d6a6f9cb 100644
--- a/content/renderer/media/media_stream_video_capturer_source.h
+++ b/content/renderer/media/media_stream_video_capturer_source.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_VIDEO_CAPTURER_SOURCE_H_
#include "base/callback.h"
+#include "base/gtest_prod_util.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/threading/thread_checker.h"
#include "content/common/media/video_capture.h"
@@ -21,7 +22,7 @@ namespace content {
class CONTENT_EXPORT VideoCapturerDelegate
: public base::RefCountedThreadSafe<VideoCapturerDelegate> {
public:
- typedef base::Callback<void(bool running)> StartedCallback;
+ typedef base::Callback<void(bool running)> RunningCallback;
explicit VideoCapturerDelegate(
const StreamDeviceInfo& device_info);
@@ -37,18 +38,21 @@ class CONTENT_EXPORT VideoCapturerDelegate
// Starts capturing frames using the resolution in |params|.
// |new_frame_callback| is triggered when a new video frame is available.
- // |started_callback| is triggered before the first video frame is received
- // or if the underlying video capturer fails to start.
+ // If capturing is started successfully then |running_callback| will be
+ // called with a parameter of true.
+ // If capturing fails to start or stopped due to an external event then
+ // |running_callback| will be called with a parameter of false.
virtual void StartCapture(
const media::VideoCaptureParams& params,
const VideoCaptureDeliverFrameCB& new_frame_callback,
- const StartedCallback& started_callback);
+ const RunningCallback& running_callback);
// Stops capturing frames and clears all callbacks including the
// SupportedFormatsCallback callback.
virtual void StopCapture();
private:
+ FRIEND_TEST_ALL_PREFIXES(MediaStreamVideoCapturerSourceTest, Ended);
friend class base::RefCountedThreadSafe<VideoCapturerDelegate>;
friend class MockVideoCapturerDelegate;
@@ -68,9 +72,9 @@ class CONTENT_EXPORT VideoCapturerDelegate
bool is_screen_cast_;
bool got_first_frame_;
- // |started_callback| is provided to this class in StartCapture and must be
+ // |running_callback| is provided to this class in StartCapture and must be
// valid until StopCapture is called.
- StartedCallback started_callback_;
+ RunningCallback running_callback_;
VideoCaptureDeviceFormatsCB source_formats_callback_;

Powered by Google App Engine
This is Rietveld 408576698