summaryrefslogtreecommitdiffstats
path: root/media/audio/cras
diff options
context:
space:
mode:
authorxians <xians@chromium.org>2014-08-27 03:21:31 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-27 10:22:14 +0000
commit2da7a5b3ead29495a3d2640343ab18c93e2805b5 (patch)
tree92f4456858de08a0e20e2e43679cdc28dc04691a /media/audio/cras
parentee0fd44359e1b292ab8a903c0329d315caea0204 (diff)
downloadchromium_src-2da7a5b3ead29495a3d2640343ab18c93e2805b5.zip
chromium_src-2da7a5b3ead29495a3d2640343ab18c93e2805b5.tar.gz
chromium_src-2da7a5b3ead29495a3d2640343ab18c93e2805b5.tar.bz2
Remove the last piece of deprecated synchronous IO code.
BUG=337096 TEST=bots Review URL: https://codereview.chromium.org/460373002 Cr-Commit-Position: refs/heads/master@{#292132}
Diffstat (limited to 'media/audio/cras')
-rw-r--r--media/audio/cras/audio_manager_cras.cc4
-rw-r--r--media/audio/cras/cras_unified.cc70
-rw-r--r--media/audio/cras/cras_unified.h8
3 files changed, 1 insertions, 81 deletions
diff --git a/media/audio/cras/audio_manager_cras.cc b/media/audio/cras/audio_manager_cras.cc
index abc78dd..ef46176 100644
--- a/media/audio/cras/audio_manager_cras.cc
+++ b/media/audio/cras/audio_manager_cras.cc
@@ -124,12 +124,10 @@ AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters(
int sample_rate = kDefaultSampleRate;
int buffer_size = kMinimumOutputBufferSize;
int bits_per_sample = 16;
- int input_channels = 0;
if (input_params.IsValid()) {
sample_rate = input_params.sample_rate();
bits_per_sample = input_params.bits_per_sample();
channel_layout = input_params.channel_layout();
- input_channels = input_params.input_channels();
buffer_size =
std::min(kMaximumOutputBufferSize,
std::max(buffer_size, input_params.frames_per_buffer()));
@@ -140,7 +138,7 @@ AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters(
buffer_size = user_buffer_size;
return AudioParameters(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, input_channels,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
sample_rate, bits_per_sample, buffer_size, AudioParameters::NO_EFFECTS);
}
diff --git a/media/audio/cras/cras_unified.cc b/media/audio/cras/cras_unified.cc
index 25af383..42d9222 100644
--- a/media/audio/cras/cras_unified.cc
+++ b/media/audio/cras/cras_unified.cc
@@ -21,30 +21,6 @@ namespace media {
// 5) Finally Close() is called. It cleans up and notifies the audio manager,
// which likely will destroy this object.
//
-// For output-only streams, a unified stream is created with 0 input channels.
-//
-// Simplified data flow for unified streams:
-//
-// +-------------+ +------------------+
-// | CRAS Server | | Chrome Client |
-// +------+------+ Add Stream +---------+--------+
-// |<----------------------------------|
-// | |
-// | buffer_frames captured to shm |
-// |---------------------------------->|
-// | | UnifiedCallback()
-// | | ReadWriteAudio()
-// | |
-// | buffer_frames written to shm |
-// |<----------------------------------|
-// | |
-// ... Repeats for each block. ...
-// | |
-// | |
-// | Remove stream |
-// |<----------------------------------|
-// | |
-//
// Simplified data flow for output only streams:
//
// +-------------+ +------------------+
@@ -86,18 +62,6 @@ CrasUnifiedStream::CrasUnifiedStream(const AudioParameters& params,
DCHECK(manager_);
DCHECK(params_.channels() > 0);
- // Must have at least one input or output. If there are both they must be the
- // same.
- int input_channels = params_.input_channels();
-
- if (input_channels) {
- // A unified stream for input and output.
- DCHECK(params_.channels() == input_channels);
- stream_direction_ = CRAS_STREAM_UNIFIED;
- input_bus_ = AudioBus::Create(input_channels,
- params_.frames_per_buffer());
- }
-
output_bus_ = AudioBus::Create(params);
}
@@ -325,9 +289,6 @@ uint32 CrasUnifiedStream::DispatchCallback(size_t frames,
case CRAS_STREAM_INPUT:
NOTREACHED() << "CrasUnifiedStream doesn't support input streams.";
return 0;
- case CRAS_STREAM_UNIFIED:
- return ReadWriteAudio(frames, input_samples, output_samples,
- input_ts, output_ts);
default:
break;
}
@@ -335,37 +296,6 @@ uint32 CrasUnifiedStream::DispatchCallback(size_t frames,
return 0;
}
-// Note these are run from a real time thread, so don't waste cycles here.
-uint32 CrasUnifiedStream::ReadWriteAudio(size_t frames,
- uint8* input_samples,
- uint8* output_samples,
- const timespec* input_ts,
- const timespec* output_ts) {
- DCHECK_EQ(frames, static_cast<size_t>(output_bus_->frames()));
- DCHECK(source_callback_);
-
- uint32 bytes_per_sample = bytes_per_frame_ / params_.channels();
- input_bus_->FromInterleaved(input_samples, frames, bytes_per_sample);
-
- // Determine latency and pass that on to the source. We have the capture time
- // of the first input sample and the playback time of the next audio sample
- // passed from the audio server, add them together for total latency.
- uint32 total_delay_bytes;
- timespec latency_ts = {0, 0};
- cras_client_calc_capture_latency(input_ts, &latency_ts);
- total_delay_bytes = GetBytesLatency(latency_ts);
- cras_client_calc_playback_latency(output_ts, &latency_ts);
- total_delay_bytes += GetBytesLatency(latency_ts);
-
- int frames_filled = source_callback_->OnMoreData(
- output_bus_.get(),
- AudioBuffersState(0, total_delay_bytes));
-
- output_bus_->ToInterleaved(frames_filled, bytes_per_sample, output_samples);
-
- return frames_filled;
-}
-
uint32 CrasUnifiedStream::WriteAudio(size_t frames,
uint8* buffer,
const timespec* sample_ts) {
diff --git a/media/audio/cras/cras_unified.h b/media/audio/cras/cras_unified.h
index db1d9fe..7e946e0 100644
--- a/media/audio/cras/cras_unified.h
+++ b/media/audio/cras/cras_unified.h
@@ -70,13 +70,6 @@ class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream {
const timespec* input_ts,
const timespec* output_ts);
- // Receives input samples and write output samples for a unified I/O stream.
- uint32 ReadWriteAudio(size_t frames,
- uint8* input_samples,
- uint8* output_samples,
- const timespec* input_ts,
- const timespec* output_ts);
-
// Writes audio for a playback stream.
uint32 WriteAudio(size_t frames, uint8* buffer, const timespec* sample_ts);
@@ -108,7 +101,6 @@ class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream {
AudioSourceCallback* source_callback_;
// Container for exchanging data with AudioSourceCallback::OnMoreData().
- scoped_ptr<AudioBus> input_bus_;
scoped_ptr<AudioBus> output_bus_;
// Direciton of the stream.