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

Side by Side Diff: content/renderer/media/audio_track_recorder.cc

Issue 1830383003: WebmMuxer: add Pause()/Resume() methods and internal time-in-pause (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | content/renderer/media/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 #include "content/renderer/media/audio_track_recorder.h" 5 #include "content/renderer/media/audio_track_recorder.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 (bits_per_second_ > 0) ? bits_per_second_ : OPUS_AUTO; 233 (bits_per_second_ > 0) ? bits_per_second_ : OPUS_AUTO;
234 if (opus_encoder_ctl(opus_encoder_, OPUS_SET_BITRATE(bitrate)) != OPUS_OK) { 234 if (opus_encoder_ctl(opus_encoder_, OPUS_SET_BITRATE(bitrate)) != OPUS_OK) {
235 DLOG(ERROR) << "Failed to set opus bitrate: " << bitrate; 235 DLOG(ERROR) << "Failed to set opus bitrate: " << bitrate;
236 return; 236 return;
237 } 237 }
238 } 238 }
239 239
240 void AudioTrackRecorder::AudioEncoder::EncodeAudio( 240 void AudioTrackRecorder::AudioEncoder::EncodeAudio(
241 scoped_ptr<media::AudioBus> input_bus, 241 scoped_ptr<media::AudioBus> input_bus,
242 const base::TimeTicks& capture_time) { 242 const base::TimeTicks& capture_time) {
243 DVLOG(1) << __FUNCTION__ << ", #frames " << input_bus->frames(); 243 DVLOG(3) << __FUNCTION__ << ", #frames " << input_bus->frames();
244 DCHECK(encoder_thread_checker_.CalledOnValidThread()); 244 DCHECK(encoder_thread_checker_.CalledOnValidThread());
245 DCHECK_EQ(input_bus->channels(), input_params_.channels()); 245 DCHECK_EQ(input_bus->channels(), input_params_.channels());
246 DCHECK(!capture_time.is_null()); 246 DCHECK(!capture_time.is_null());
247 DCHECK(converter_); 247 DCHECK(converter_);
248 248
249 if (!is_initialized() || paused_) 249 if (!is_initialized() || paused_)
250 return; 250 return;
251 // TODO(mcasas): Consider using a std::deque<scoped_ptr<AudioBus>> instead of 251 // TODO(mcasas): Consider using a std::deque<scoped_ptr<AudioBus>> instead of
252 // an AudioFifo, to avoid copying data needlessly since we know the sizes of 252 // an AudioFifo, to avoid copying data needlessly since we know the sizes of
253 // both input and output and they are multiples. 253 // both input and output and they are multiples.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 350
351 void AudioTrackRecorder::Resume() { 351 void AudioTrackRecorder::Resume() {
352 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 352 DCHECK(main_render_thread_checker_.CalledOnValidThread());
353 DCHECK(encoder_); 353 DCHECK(encoder_);
354 encoder_thread_.task_runner()->PostTask( 354 encoder_thread_.task_runner()->PostTask(
355 FROM_HERE, base::Bind(&AudioEncoder::set_paused, encoder_, false)); 355 FROM_HERE, base::Bind(&AudioEncoder::set_paused, encoder_, false));
356 } 356 }
357 357
358 } // namespace content 358 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_recorder_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698