| 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_RECORDER_MEDIA_RECORDER_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 void OnEncodedVideo(const media::WebmMuxer::VideoParameters& params, | 68 void OnEncodedVideo(const media::WebmMuxer::VideoParameters& params, |
| 69 std::unique_ptr<std::string> encoded_data, | 69 std::unique_ptr<std::string> encoded_data, |
| 70 base::TimeTicks timestamp, | 70 base::TimeTicks timestamp, |
| 71 bool is_key_frame); | 71 bool is_key_frame); |
| 72 void OnEncodedAudio(const media::AudioParameters& params, | 72 void OnEncodedAudio(const media::AudioParameters& params, |
| 73 std::unique_ptr<std::string> encoded_data, | 73 std::unique_ptr<std::string> encoded_data, |
| 74 base::TimeTicks timestamp); | 74 base::TimeTicks timestamp); |
| 75 void WriteData(base::StringPiece data); | 75 void WriteData(base::StringPiece data); |
| 76 | 76 |
| 77 // Updates |media_stream_num_tracks_| and returns true if it has changed. |
| 78 bool CheckAndUpdateAmountOfTracks(); |
| 79 |
| 77 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, | 80 void OnVideoFrameForTesting(const scoped_refptr<media::VideoFrame>& frame, |
| 78 const base::TimeTicks& timestamp); | 81 const base::TimeTicks& timestamp); |
| 79 void OnAudioBusForTesting(const media::AudioBus& audio_bus, | 82 void OnAudioBusForTesting(const media::AudioBus& audio_bus, |
| 80 const base::TimeTicks& timestamp); | 83 const base::TimeTicks& timestamp); |
| 81 void SetAudioFormatForTesting(const media::AudioParameters& params); | 84 void SetAudioFormatForTesting(const media::AudioParameters& params); |
| 82 | 85 |
| 83 // Bound to the main render thread. | 86 // Bound to the main render thread. |
| 84 base::ThreadChecker main_render_thread_checker_; | 87 base::ThreadChecker main_render_thread_checker_; |
| 85 | 88 |
| 86 // Sanitized video and audio bitrate settings passed on initialize(). | 89 // Sanitized video and audio bitrate settings passed on initialize(). |
| 87 int32_t video_bits_per_second_; | 90 int32_t video_bits_per_second_; |
| 88 int32_t audio_bits_per_second_; | 91 int32_t audio_bits_per_second_; |
| 89 | 92 |
| 90 // Video Codec, VP8 is used by default. | 93 // Video Codec, VP8 is used by default. |
| 91 VideoTrackRecorder::CodecId codec_id_; | 94 VideoTrackRecorder::CodecId codec_id_; |
| 92 | 95 |
| 93 // |client_| has no notion of time, thus may configure us via start(timeslice) | 96 // |client_| has no notion of time, thus may configure us via start(timeslice) |
| 94 // to notify it after a certain |timeslice_| has passed. We use a moving | 97 // to notify it after a certain |timeslice_| has passed. We use a moving |
| 95 // |slice_origin_timestamp_| to track those time chunks. | 98 // |slice_origin_timestamp_| to track those time chunks. |
| 96 base::TimeDelta timeslice_; | 99 base::TimeDelta timeslice_; |
| 97 base::TimeTicks slice_origin_timestamp_; | 100 base::TimeTicks slice_origin_timestamp_; |
| 98 | 101 |
| 99 bool recording_; | 102 bool recording_; |
| 100 blink::WebMediaStream media_stream_; // The MediaStream being recorded. | 103 blink::WebMediaStream media_stream_; // The MediaStream being recorded. |
| 104 size_t media_stream_num_tracks_; |
| 101 | 105 |
| 102 // |client_| is a weak pointer, and is valid for the lifetime of this object. | 106 // |client_| is a weak pointer, and is valid for the lifetime of this object. |
| 103 blink::WebMediaRecorderHandlerClient* client_; | 107 blink::WebMediaRecorderHandlerClient* client_; |
| 104 | 108 |
| 105 std::vector<std::unique_ptr<VideoTrackRecorder>> video_recorders_; | 109 std::vector<std::unique_ptr<VideoTrackRecorder>> video_recorders_; |
| 106 std::vector<std::unique_ptr<AudioTrackRecorder>> audio_recorders_; | 110 std::vector<std::unique_ptr<AudioTrackRecorder>> audio_recorders_; |
| 107 | 111 |
| 108 // Worker class doing the actual Webm Muxing work. | 112 // Worker class doing the actual Webm Muxing work. |
| 109 std::unique_ptr<media::WebmMuxer> webm_muxer_; | 113 std::unique_ptr<media::WebmMuxer> webm_muxer_; |
| 110 | 114 |
| 111 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_; | 115 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_; |
| 112 | 116 |
| 113 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler); | 117 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler); |
| 114 }; | 118 }; |
| 115 | 119 |
| 116 } // namespace content | 120 } // namespace content |
| 117 #endif // CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_ | 121 #endif // CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_ |
| OLD | NEW |