Commit 0edeab52 authored by Max Morin's avatar Max Morin Committed by Commit Bot

Fix logging of StreamBrokerDisconnectReason

The case where the connection is broken by the renderer is logged
incorrectly.

Bug: 851865
Change-Id: I72a69c5b9fa84a6f8c569b29fbcb0528c16c0524
Reviewed-on: https://chromium-review.googlesource.com/1096770
Commit-Queue: Max Morin <maxmorin@chromium.org>
Reviewed-by: default avatarOlga Sharonova <olka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566777}
parent 068c897f
...@@ -52,8 +52,8 @@ AudioInputStreamBroker::AudioInputStreamBroker( ...@@ -52,8 +52,8 @@ AudioInputStreamBroker::AudioInputStreamBroker(
TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("audio", "AudioInputStreamBroker", this); TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("audio", "AudioInputStreamBroker", this);
// Unretained is safe because |this| owns |renderer_factory_client_|. // Unretained is safe because |this| owns |renderer_factory_client_|.
renderer_factory_client_.set_connection_error_handler( renderer_factory_client_.set_connection_error_handler(base::BindOnce(
base::BindOnce(&AudioInputStreamBroker::Cleanup, base::Unretained(this))); &AudioInputStreamBroker::ClientBindingLost, base::Unretained(this)));
// Notify RenderProcessHost about input stream so the renderer is not // Notify RenderProcessHost about input stream so the renderer is not
// background. // background.
...@@ -210,6 +210,12 @@ void AudioInputStreamBroker::ObserverBindingLost( ...@@ -210,6 +210,12 @@ void AudioInputStreamBroker::ObserverBindingLost(
Cleanup(); Cleanup();
} }
void AudioInputStreamBroker::ClientBindingLost() {
disconnect_reason_ = media::mojom::AudioInputStreamObserver::
DisconnectReason::kTerminatedByClient;
Cleanup();
}
void AudioInputStreamBroker::Cleanup() { void AudioInputStreamBroker::Cleanup() {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
......
...@@ -54,7 +54,7 @@ class CONTENT_EXPORT AudioInputStreamBroker final ...@@ -54,7 +54,7 @@ class CONTENT_EXPORT AudioInputStreamBroker final
const base::Optional<base::UnguessableToken>& stream_id); const base::Optional<base::UnguessableToken>& stream_id);
void ObserverBindingLost(uint32_t reason, const std::string& description); void ObserverBindingLost(uint32_t reason, const std::string& description);
void ClientBindingLost();
void Cleanup(); void Cleanup();
const std::string device_id_; const std::string device_id_;
......
...@@ -48,7 +48,7 @@ AudioOutputStreamBroker::AudioOutputStreamBroker( ...@@ -48,7 +48,7 @@ AudioOutputStreamBroker::AudioOutputStreamBroker(
// Unretained is safe because |this| owns |client_| // Unretained is safe because |this| owns |client_|
client_.set_connection_error_handler(base::BindOnce( client_.set_connection_error_handler(base::BindOnce(
&AudioOutputStreamBroker::Cleanup, base::Unretained(this))); &AudioOutputStreamBroker::ClientBindingLost, base::Unretained(this)));
} }
AudioOutputStreamBroker::~AudioOutputStreamBroker() { AudioOutputStreamBroker::~AudioOutputStreamBroker() {
...@@ -149,6 +149,12 @@ void AudioOutputStreamBroker::ObserverBindingLost( ...@@ -149,6 +149,12 @@ void AudioOutputStreamBroker::ObserverBindingLost(
Cleanup(); Cleanup();
} }
void AudioOutputStreamBroker::ClientBindingLost() {
disconnect_reason_ = media::mojom::AudioOutputStreamObserver::
DisconnectReason::kTerminatedByClient;
Cleanup();
}
void AudioOutputStreamBroker::Cleanup() { void AudioOutputStreamBroker::Cleanup() {
DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_); DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_);
std::move(deleter_).Run(this); std::move(deleter_).Run(this);
......
...@@ -46,6 +46,7 @@ class CONTENT_EXPORT AudioOutputStreamBroker final : public AudioStreamBroker { ...@@ -46,6 +46,7 @@ class CONTENT_EXPORT AudioOutputStreamBroker final : public AudioStreamBroker {
void StreamCreated(media::mojom::AudioOutputStreamPtr stream, void StreamCreated(media::mojom::AudioOutputStreamPtr stream,
media::mojom::ReadWriteAudioDataPipePtr data_pipe); media::mojom::ReadWriteAudioDataPipePtr data_pipe);
void ObserverBindingLost(uint32_t reason, const std::string& description); void ObserverBindingLost(uint32_t reason, const std::string& description);
void ClientBindingLost();
void Cleanup(); void Cleanup();
SEQUENCE_CHECKER(owning_sequence_); SEQUENCE_CHECKER(owning_sequence_);
......
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