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

Side by Side Diff: content/renderer/media/recorder/media_recorder_handler.h

Issue 2697703003: MediaRecorder: make sure ondataavailable+onstop events are fired before onerror (Closed)
Patch Set: fix some naming confusion Created 3 years, 10 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
« no previous file with comments | « no previous file | content/renderer/media/recorder/media_recorder_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 |video_tracks_|,|audio_tracks_| and returns true if any changed.
78 bool UpdateTracksAndCheckIfChanged();
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 blink::WebVector<blink::WebMediaStreamTrack> video_tracks_;
105 blink::WebVector<blink::WebMediaStreamTrack> audio_tracks_;
101 106
102 // |client_| is a weak pointer, and is valid for the lifetime of this object. 107 // |client_| is a weak pointer, and is valid for the lifetime of this object.
103 blink::WebMediaRecorderHandlerClient* client_; 108 blink::WebMediaRecorderHandlerClient* client_;
104 109
105 std::vector<std::unique_ptr<VideoTrackRecorder>> video_recorders_; 110 std::vector<std::unique_ptr<VideoTrackRecorder>> video_recorders_;
106 std::vector<std::unique_ptr<AudioTrackRecorder>> audio_recorders_; 111 std::vector<std::unique_ptr<AudioTrackRecorder>> audio_recorders_;
107 112
108 // Worker class doing the actual Webm Muxing work. 113 // Worker class doing the actual Webm Muxing work.
109 std::unique_ptr<media::WebmMuxer> webm_muxer_; 114 std::unique_ptr<media::WebmMuxer> webm_muxer_;
110 115
111 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_; 116 base::WeakPtrFactory<MediaRecorderHandler> weak_factory_;
112 117
113 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler); 118 DISALLOW_COPY_AND_ASSIGN(MediaRecorderHandler);
114 }; 119 };
115 120
116 } // namespace content 121 } // namespace content
117 #endif // CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_ 122 #endif // CONTENT_RENDERER_MEDIA_RECORDER_MEDIA_RECORDER_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/recorder/media_recorder_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698