| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/remoting/remoting_controller.h" | 5 #include "media/remoting/remoting_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 void RemotingController::OnMetadataChanged(const PipelineMetadata& metadata) { | 98 void RemotingController::OnMetadataChanged(const PipelineMetadata& metadata) { |
| 99 DCHECK(task_runner_->BelongsToCurrentThread()); | 99 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 100 | 100 |
| 101 has_video_ = metadata.has_video; | 101 has_video_ = metadata.has_video; |
| 102 has_audio_ = metadata.has_audio; | 102 has_audio_ = metadata.has_audio; |
| 103 if (!has_video_ && !has_audio_) | 103 if (!has_video_ && !has_audio_) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 // On Android, when using the MediaPlayerRenderer, |has_video_| and |
| 107 // |has_audio_| will be true, but the respective configs will be empty. |
| 108 // We cannot make any assumptions on the validity of configs. |
| 106 if (has_video_) { | 109 if (has_video_) { |
| 107 DCHECK(metadata.video_decoder_config.IsValidConfig()); | |
| 108 video_decoder_config_ = metadata.video_decoder_config; | 110 video_decoder_config_ = metadata.video_decoder_config; |
| 109 is_encrypted_ |= video_decoder_config_.is_encrypted(); | 111 is_encrypted_ |= video_decoder_config_.is_encrypted(); |
| 110 } | 112 } |
| 111 if (has_audio_) { | 113 if (has_audio_) { |
| 112 DCHECK(metadata.audio_decoder_config.IsValidConfig()); | |
| 113 audio_decoder_config_ = metadata.audio_decoder_config; | 114 audio_decoder_config_ = metadata.audio_decoder_config; |
| 114 is_encrypted_ |= audio_decoder_config_.is_encrypted(); | 115 is_encrypted_ |= audio_decoder_config_.is_encrypted(); |
| 115 } | 116 } |
| 116 UpdateAndMaybeSwitch(); | 117 UpdateAndMaybeSwitch(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 bool RemotingController::IsVideoCodecSupported() { | 120 bool RemotingController::IsVideoCodecSupported() { |
| 120 DCHECK(task_runner_->BelongsToCurrentThread()); | 121 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 121 DCHECK(has_video_); | 122 DCHECK(has_video_); |
| 122 | 123 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // |swithc_renderer_cb_.Run()| will be called after remoting is started | 201 // |swithc_renderer_cb_.Run()| will be called after remoting is started |
| 201 // successfully. | 202 // successfully. |
| 202 remoter_->Start(); | 203 remoter_->Start(); |
| 203 } else { | 204 } else { |
| 204 switch_renderer_cb_.Run(); | 205 switch_renderer_cb_.Run(); |
| 205 remoter_->Stop(mojom::RemotingStopReason::LOCAL_PLAYBACK); | 206 remoter_->Stop(mojom::RemotingStopReason::LOCAL_PLAYBACK); |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace media | 210 } // namespace media |
| OLD | NEW |