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

Side by Side Diff: content/renderer/media/mock_media_stream_video_source.h

Issue 1829193003: Request frame for new sinks from MediaStreamVideoTrack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: miu@ nit. Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
7 7
8 #include "content/renderer/media/media_stream_video_source.h" 8 #include "content/renderer/media/media_stream_video_source.h"
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 class MockMediaStreamVideoSource : public MediaStreamVideoSource { 15 class MockMediaStreamVideoSource : public MediaStreamVideoSource {
16 public: 16 public:
17 explicit MockMediaStreamVideoSource(bool manual_get_supported_formats); 17 explicit MockMediaStreamVideoSource(bool manual_get_supported_formats);
18 MockMediaStreamVideoSource(bool manual_get_supported_formats,
19 bool respond_to_request_refresh_frame);
18 virtual ~MockMediaStreamVideoSource(); 20 virtual ~MockMediaStreamVideoSource();
19 21
20 MOCK_METHOD1(DoSetMutedState, void(bool muted_state)); 22 MOCK_METHOD1(DoSetMutedState, void(bool muted_state));
21 23
22 // Simulate that the underlying source start successfully. 24 // Simulate that the underlying source start successfully.
23 void StartMockedSource(); 25 void StartMockedSource();
24 26
25 // Simulate that the underlying source fail to start. 27 // Simulate that the underlying source fail to start.
26 void FailToStartMockedSource(); 28 void FailToStartMockedSource();
27 29
(...skipping 15 matching lines...) Expand all
43 const media::VideoCaptureFormat& start_format() const { return format_; } 45 const media::VideoCaptureFormat& start_format() const { return format_; }
44 int max_requested_height() const { return max_requested_height_; } 46 int max_requested_height() const { return max_requested_height_; }
45 int max_requested_width() const { return max_requested_width_; } 47 int max_requested_width() const { return max_requested_width_; }
46 double max_requested_frame_rate() const { return max_requested_frame_rate_; } 48 double max_requested_frame_rate() const { return max_requested_frame_rate_; }
47 49
48 void SetMutedState(bool muted_state) override { 50 void SetMutedState(bool muted_state) override {
49 MediaStreamVideoSource::SetMutedState(muted_state); 51 MediaStreamVideoSource::SetMutedState(muted_state);
50 DoSetMutedState(muted_state); 52 DoSetMutedState(muted_state);
51 } 53 }
52 54
55 // Implements MediaStreamVideoSource.
56 void RequestRefreshFrame() override;
57
53 protected: 58 protected:
54 // Implements MediaStreamVideoSource. 59 // Implements MediaStreamVideoSource.
55 void GetCurrentSupportedFormats( 60 void GetCurrentSupportedFormats(
56 int max_requested_height, 61 int max_requested_height,
57 int max_requested_width, 62 int max_requested_width,
58 double max_requested_frame_rate, 63 double max_requested_frame_rate,
59 const VideoCaptureDeviceFormatsCB& callback) override; 64 const VideoCaptureDeviceFormatsCB& callback) override;
60 void StartSourceImpl( 65 void StartSourceImpl(
61 const media::VideoCaptureFormat& format, 66 const media::VideoCaptureFormat& format,
62 const blink::WebMediaConstraints& constraints, 67 const blink::WebMediaConstraints& constraints,
63 const VideoCaptureDeliverFrameCB& frame_callback) override; 68 const VideoCaptureDeliverFrameCB& frame_callback) override;
64 void StopSourceImpl() override; 69 void StopSourceImpl() override;
65 70
66 private: 71 private:
67 media::VideoCaptureFormat format_; 72 media::VideoCaptureFormat format_;
68 media::VideoCaptureFormats supported_formats_; 73 media::VideoCaptureFormats supported_formats_;
69 bool manual_get_supported_formats_; 74 bool manual_get_supported_formats_;
75 bool respond_to_request_refresh_frame_;
70 int max_requested_height_; 76 int max_requested_height_;
71 int max_requested_width_; 77 int max_requested_width_;
72 double max_requested_frame_rate_; 78 double max_requested_frame_rate_;
73 bool attempted_to_start_; 79 bool attempted_to_start_;
74 VideoCaptureDeviceFormatsCB formats_callback_; 80 VideoCaptureDeviceFormatsCB formats_callback_;
75 VideoCaptureDeliverFrameCB frame_callback_; 81 VideoCaptureDeliverFrameCB frame_callback_;
76 82
77 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource); 83 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource);
78 }; 84 };
79 85
80 } // namespace content 86 } // namespace content
81 87
82 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 88 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_track_unittest.cc ('k') | content/renderer/media/mock_media_stream_video_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698