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

Unified Diff: content/renderer/media/external_media_stream_audio_source.cc

Issue 1966043006: Revert of MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/external_media_stream_audio_source.cc
diff --git a/content/renderer/media/external_media_stream_audio_source.cc b/content/renderer/media/external_media_stream_audio_source.cc
deleted file mode 100644
index 60a68241b6fff060060078e60693b6ea43010041..0000000000000000000000000000000000000000
--- a/content/renderer/media/external_media_stream_audio_source.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/media/external_media_stream_audio_source.h"
-
-namespace content {
-
-ExternalMediaStreamAudioSource::ExternalMediaStreamAudioSource(
- scoped_refptr<media::AudioCapturerSource> source,
- int sample_rate,
- media::ChannelLayout channel_layout,
- int frames_per_buffer,
- bool is_remote)
- : MediaStreamAudioSource(!is_remote), source_(std::move(source)),
- was_started_(false) {
- DVLOG(1)
- << "ExternalMediaStreamAudioSource::ExternalMediaStreamAudioSource()";
- DCHECK(source_.get());
- MediaStreamAudioSource::SetFormat(media::AudioParameters(
- media::AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- sample_rate,
- 16, // Legacy parameter (data is always in 32-bit float format).
- frames_per_buffer));
-}
-
-ExternalMediaStreamAudioSource::~ExternalMediaStreamAudioSource() {
- DVLOG(1)
- << "ExternalMediaStreamAudioSource::~ExternalMediaStreamAudioSource()";
- EnsureSourceIsStopped();
-}
-
-bool ExternalMediaStreamAudioSource::EnsureSourceIsStarted() {
- DCHECK(thread_checker_.CalledOnValidThread());
- if (was_started_)
- return true;
- VLOG(1) << "Starting externally-provided "
- << (is_local_source() ? "local" : "remote")
- << " source with audio parameters={"
- << GetAudioParameters().AsHumanReadableString() << "}.";
- source_->Initialize(GetAudioParameters(), this, -1);
- source_->Start();
- was_started_ = true;
- return true;
-}
-
-void ExternalMediaStreamAudioSource::EnsureSourceIsStopped() {
- DCHECK(thread_checker_.CalledOnValidThread());
- if (!source_)
- return;
- if (was_started_)
- source_->Stop();
- source_ = nullptr;
- VLOG(1) << "Stopped externally-provided "
- << (is_local_source() ? "local" : "remote")
- << " source with audio parameters={"
- << GetAudioParameters().AsHumanReadableString() << "}.";
-}
-
-void ExternalMediaStreamAudioSource::Capture(const media::AudioBus* audio_bus,
- int audio_delay_milliseconds,
- double volume,
- bool key_pressed) {
- DCHECK(audio_bus);
- // TODO(miu): Plumbing is needed to determine the actual capture timestamp
- // of the audio, instead of just snapshotting TimeTicks::Now(), for proper
- // audio/video sync. http://crbug.com/335335
- MediaStreamAudioSource::DeliverDataToTracks(
- *audio_bus,
- base::TimeTicks::Now() -
- base::TimeDelta::FromMilliseconds(audio_delay_milliseconds));
-}
-
-void ExternalMediaStreamAudioSource::OnCaptureError(const std::string& why) {
- // As of this writing, this method doesn't get called for anything useful,
- // and all other implementors just log the message, but don't disconnect sinks
- // or take any other action. So, just log the error.
- LOG(ERROR) << why;
-}
-
-} // namespace content
« no previous file with comments | « content/renderer/media/external_media_stream_audio_source.h ('k') | content/renderer/media/media_stream_audio_deliverer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698