Commit 8c3ac300 authored by Ken MacKay's avatar Ken MacKay Committed by Commit Bot

[Chromecast] Fix mixer service padding handling

When not receving into a buffer pool, it was not accounting for the
padding correctly.

Also, make sure connection error only happens once.

Change-Id: I04d3b171828fc8f35b6cfa2ac5872e02f6f2145e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894811
Commit-Queue: Kenneth MacKay <kmackay@chromium.org>
Commit-Queue: Yuchen Liu <yucliu@chromium.org>
Auto-Submit: Kenneth MacKay <kmackay@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711572}
parent c3263287
...@@ -312,6 +312,10 @@ bool MixerSocket::ParseAudio(char* data, int size) { ...@@ -312,6 +312,10 @@ bool MixerSocket::ParseAudio(char* data, int size) {
data += sizeof(timestamp); data += sizeof(timestamp);
size -= sizeof(timestamp); size -= sizeof(timestamp);
// Handle padding bytes.
data += sizeof(int32_t);
size -= sizeof(int32_t);
return delegate_->HandleAudioData(data, size, timestamp); return delegate_->HandleAudioData(data, size, timestamp);
} }
......
...@@ -333,6 +333,10 @@ bool MixerInputConnection::HandleAudioBuffer( ...@@ -333,6 +333,10 @@ bool MixerInputConnection::HandleAudioBuffer(
void MixerInputConnection::OnConnectionError() { void MixerInputConnection::OnConnectionError() {
DCHECK(io_task_runner_->RunsTasksInCurrentSequence()); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
if (connection_error_) {
return;
}
connection_error_ = true;
socket_.reset(); socket_.reset();
weak_factory_.InvalidateWeakPtrs(); weak_factory_.InvalidateWeakPtrs();
......
...@@ -153,6 +153,7 @@ class MixerInputConnection : public mixer_service::MixerSocket::Delegate, ...@@ -153,6 +153,7 @@ class MixerInputConnection : public mixer_service::MixerSocket::Delegate,
// Only used on the IO thread. // Only used on the IO thread.
bool audio_ready_for_playback_fired_ = false; bool audio_ready_for_playback_fired_ = false;
base::OneShotTimer inactivity_timer_; base::OneShotTimer inactivity_timer_;
bool connection_error_ = false;
base::Lock lock_; base::Lock lock_;
State state_ GUARDED_BY(lock_) = State::kUninitialized; State state_ GUARDED_BY(lock_) = State::kUninitialized;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment