diff options
author | mcchou <mcchou@chromium.org> | 2015-03-26 14:36:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-26 21:37:30 +0000 |
commit | ad8553a80203d8be31fc1cd60a4291883bcb3849 (patch) | |
tree | 4397778e08c9038c6a32f83463f3ba4d0c049790 /device | |
parent | b53749fec68b4f2f9daacef9cbbe75e2f58f7805 (diff) | |
download | chromium_src-ad8553a80203d8be31fc1cd60a4291883bcb3849.zip chromium_src-ad8553a80203d8be31fc1cd60a4291883bcb3849.tar.gz chromium_src-ad8553a80203d8be31fc1cd60a4291883bcb3849.tar.bz2 |
device/bluetooth: Add read_mtu as an argument of BluetoothAudioSinkDataAvailable.
This CL added read_mtu into the signature of
BluetoothAudioSink::Observer::BluetoothAudioSinkDataAvailable and
modified corresponding tests.
BUG=441581
TEST=device_unittests --gtest_filter=*AudioSink*
Review URL: https://codereview.chromium.org/1034893002
Cr-Commit-Position: refs/heads/master@{#322476}
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_audio_sink.h | 10 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_audio_sink_chromeos.cc | 5 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc | 15 |
3 files changed, 23 insertions, 7 deletions
diff --git a/device/bluetooth/bluetooth_audio_sink.h b/device/bluetooth/bluetooth_audio_sink.h index c7de607..3735925 100644 --- a/device/bluetooth/bluetooth_audio_sink.h +++ b/device/bluetooth/bluetooth_audio_sink.h @@ -75,12 +75,14 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAudioSink // Called when there is audio data available. |audio_sink| indicates the // object being changed. |data| is the pointer to the audio data and |size| - // is the number of bytes in |data|. This method provides the raw audio data - // which hasn't been processed, so RTP assembling and SBC decoding need to - // be handled in order to get PCM data. + // is the number of bytes in |data|. |read_mtu| is the max size of the RTP + // packet. This method provides the raw audio data which hasn't been + // processed, so RTP assembling and SBC decoding need to be handled in order + // to get PCM data. virtual void BluetoothAudioSinkDataAvailable(BluetoothAudioSink* audio_sink, char* data, - size_t size) = 0; + size_t size, + uint16_t read_mtu) = 0; }; // The ErrorCallback is used for the methods that can fail in which case it diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos.cc b/device/bluetooth/bluetooth_audio_sink_chromeos.cc index 0f76be8..dcd751b 100644 --- a/device/bluetooth/bluetooth_audio_sink_chromeos.cc +++ b/device/bluetooth/bluetooth_audio_sink_chromeos.cc @@ -400,8 +400,9 @@ void BluetoothAudioSinkChromeOS::ReadFromFile() { } VLOG(1) << "ReadFromFile - read " << size << " bytes"; - FOR_EACH_OBSERVER(BluetoothAudioSink::Observer, observers_, - BluetoothAudioSinkDataAvailable(this, data_.get(), size)); + FOR_EACH_OBSERVER( + BluetoothAudioSink::Observer, observers_, + BluetoothAudioSinkDataAvailable(this, data_.get(), size, read_mtu_)); } void BluetoothAudioSinkChromeOS::StateChanged( diff --git a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc index b415e73..9781dec 100644 --- a/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_audio_sink_chromeos_unittest.cc @@ -58,10 +58,12 @@ class TestAudioSinkObserver : public BluetoothAudioSink::Observer { void BluetoothAudioSinkDataAvailable(BluetoothAudioSink* audio_sink, char* data, - size_t size) override { + size_t size, + uint16_t read_mtu) override { total_read_ += size; data_.clear(); data_.insert(data_.begin(), data, data + size); + read_mtu_ = read_mtu; } int state_changed_count_; @@ -69,6 +71,7 @@ class TestAudioSinkObserver : public BluetoothAudioSink::Observer { int data_available_count_; size_t total_read_; std::vector<char> data_; + uint16_t read_mtu_; BluetoothAudioSink::State state_; private: @@ -838,6 +841,8 @@ TEST_F(BluetoothAudioSinkChromeOSTest, AcquireFD) { EXPECT_EQ(observer_->state_changed_count_, 3); EXPECT_EQ(observer_->total_read_, data_one.size()); EXPECT_EQ(observer_->data_, data_one); + EXPECT_EQ(observer_->read_mtu_, + FakeBluetoothMediaTransportClient::kDefaultReadMtu); } // Tests the case where the remote device pauses and resume audio streaming. @@ -873,6 +878,8 @@ TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) { message_loop_.RunUntilIdle(); EXPECT_EQ(observer_->data_, data_one); + EXPECT_EQ(observer_->read_mtu_, + FakeBluetoothMediaTransportClient::kDefaultReadMtu); EXPECT_EQ(observer_->state_changed_count_, 3); EXPECT_EQ(observer_->total_read_, data_one.size()); @@ -891,6 +898,8 @@ TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) { message_loop_.RunUntilIdle(); EXPECT_EQ(observer_->data_, data_two); + EXPECT_EQ(observer_->read_mtu_, + FakeBluetoothMediaTransportClient::kDefaultReadMtu); EXPECT_EQ(observer_->state_changed_count_, 6); EXPECT_EQ(observer_->total_read_, data_two.size()); } @@ -927,6 +936,8 @@ TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) { message_loop_.RunUntilIdle(); EXPECT_EQ(observer_->data_, data_one); + EXPECT_EQ(observer_->read_mtu_, + FakeBluetoothMediaTransportClient::kDefaultReadMtu); EXPECT_EQ(observer_->state_changed_count_, 3); EXPECT_EQ(observer_->total_read_, data_one.size()); @@ -936,6 +947,8 @@ TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) { message_loop_.RunUntilIdle(); EXPECT_EQ(observer_->data_, data_two); + EXPECT_EQ(observer_->read_mtu_, + FakeBluetoothMediaTransportClient::kDefaultReadMtu); EXPECT_EQ(observer_->state_changed_count_, 3); EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size()); } |