OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MEDIA_RECORDER_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "third_party/WebKit/public/platform/WebMediaRecorderHandler.h" | |
13 #include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h" | 14 #include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h" |
14 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 15 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 class WebString; | 18 class WebString; |
18 } // namespace blink | 19 } // namespace blink |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 class VideoFrame; | 22 class VideoFrame; |
22 class WebmMuxer; | 23 class WebmMuxer; |
23 } // namespace media | 24 } // namespace media |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 class VideoTrackRecorder; | 28 class VideoTrackRecorder; |
28 | 29 |
29 // MediaRecorderHandler orchestrates the creation, lifetime mgmt and mapping | 30 // MediaRecorderHandler orchestrates the creation, lifetime mgmt and mapping |
30 // between: | 31 // between: |
31 // - MediaStreamTrack(s) providing data, | 32 // - MediaStreamTrack(s) providing data, |
32 // - {Audio,Video}TrackRecorders encoding that data, | 33 // - {Audio,Video}TrackRecorders encoding that data, |
33 // - a WebmMuxer class multiplexing encoded data into a WebM container, and | 34 // - a WebmMuxer class multiplexing encoded data into a WebM container, and |
34 // - a single recorder client receiving this contained data. | 35 // - a single recorder client receiving this contained data. |
35 // All methods are called on the same thread as construction and destruction, | 36 // All methods are called on the same thread as construction and destruction, |
36 // i.e. the Main Render thread. | 37 // i.e. the Main Render thread. |
37 // TODO(mcasas): Implement audio recording. | 38 // TODO(mcasas): Implement audio recording. |
38 class CONTENT_EXPORT MediaRecorderHandler final { | 39 class CONTENT_EXPORT MediaRecorderHandler final |
40 : public blink::WebMediaRecorderHandler { | |
39 public: | 41 public: |
40 MediaRecorderHandler(); | 42 MediaRecorderHandler(); |
41 ~MediaRecorderHandler(); | 43 ~MediaRecorderHandler(); |
miu
2015/09/10 02:31:47
Please add override keyword for the dtor too.
| |
42 | 44 |
43 // See above, these methods should override blink::WebMediaRecorderHandler. | 45 // See above, these methods should override blink::WebMediaRecorderHandler. |
44 bool canSupportMimeType(const blink::WebString& mimeType); | 46 bool canSupportMimeType(const blink::WebString& mimeType) override; |
45 bool initialize(blink::WebMediaRecorderHandlerClient* client, | 47 bool initialize(blink::WebMediaRecorderHandlerClient* client, |
46 const blink::WebMediaStream& media_stream, | 48 const blink::WebMediaStream& media_stream, |
47 const blink::WebString& mimeType); | 49 const blink::WebString& mimeType) override; |
48 bool start(); | 50 bool start() override; |
49 bool start(int timeslice); | 51 bool start(int timeslice) override; |
50 void stop(); | 52 void stop() override; |
51 void pause(); | 53 void pause() override; |
52 void resume(); | 54 void resume() override; |
53 | 55 |
54 private: | 56 private: |
55 friend class MediaRecorderHandlerTest; | 57 friend class MediaRecorderHandlerTest; |
56 | 58 |
57 void WriteData(const base::StringPiece& data); | 59 void WriteData(const base::StringPiece& data); |
58 | 60 |
59 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, | 61 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, |
60 const base::TimeTicks& timestamp); | 62 const base::TimeTicks& timestamp); |
61 | 63 |
62 // Bound to the main render thread. | 64 // Bound to the main render thread. |
(...skipping 10 matching lines...) Expand all Loading... | |
73 // Worker class doing the actual Webm Muxing work. | 75 // Worker class doing the actual Webm Muxing work. |
74 scoped_ptr<media::WebmMuxer> webm_muxer_; | 76 scoped_ptr<media::WebmMuxer> webm_muxer_; |
75 | 77 |
76 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_; | 78 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_; |
77 | 79 |
78 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler); | 80 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace content | 83 } // namespace content |
82 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ | 84 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RECORDER_HANDLER_H_ |
OLD | NEW |