| 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/courier_renderer.h" | 5 #include "media/remoting/courier_renderer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 312 |
| 313 void CourierRenderer::OnDataPipeCreated( | 313 void CourierRenderer::OnDataPipeCreated( |
| 314 mojom::RemotingDataStreamSenderPtrInfo audio, | 314 mojom::RemotingDataStreamSenderPtrInfo audio, |
| 315 mojom::RemotingDataStreamSenderPtrInfo video, | 315 mojom::RemotingDataStreamSenderPtrInfo video, |
| 316 mojo::ScopedDataPipeProducerHandle audio_handle, | 316 mojo::ScopedDataPipeProducerHandle audio_handle, |
| 317 mojo::ScopedDataPipeProducerHandle video_handle, | 317 mojo::ScopedDataPipeProducerHandle video_handle, |
| 318 int audio_rpc_handle, | 318 int audio_rpc_handle, |
| 319 int video_rpc_handle) { | 319 int video_rpc_handle) { |
| 320 VLOG(2) << __func__; | 320 VLOG(2) << __func__; |
| 321 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 321 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
| 322 DCHECK(!init_workflow_done_callback_.is_null()); | |
| 323 | 322 |
| 324 if (state_ == STATE_ERROR) | 323 if (state_ == STATE_ERROR) |
| 325 return; // Abort because something went wrong in the meantime. | 324 return; // Abort because something went wrong in the meantime. |
| 326 DCHECK_EQ(state_, STATE_CREATE_PIPE); | 325 DCHECK_EQ(state_, STATE_CREATE_PIPE); |
| 326 DCHECK(!init_workflow_done_callback_.is_null()); |
| 327 | 327 |
| 328 // Create audio demuxer stream adapter if audio is available. | 328 // Create audio demuxer stream adapter if audio is available. |
| 329 DemuxerStream* audio_demuxer_stream = | 329 DemuxerStream* audio_demuxer_stream = |
| 330 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); | 330 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); |
| 331 if (audio_demuxer_stream && audio.is_valid() && audio_handle.is_valid() && | 331 if (audio_demuxer_stream && audio.is_valid() && audio_handle.is_valid() && |
| 332 audio_rpc_handle != RpcBroker::kInvalidHandle) { | 332 audio_rpc_handle != RpcBroker::kInvalidHandle) { |
| 333 VLOG(2) << "Initialize audio"; | 333 VLOG(2) << "Initialize audio"; |
| 334 audio_demuxer_stream_adapter_.reset(new DemuxerStreamAdapter( | 334 audio_demuxer_stream_adapter_.reset(new DemuxerStreamAdapter( |
| 335 main_task_runner_, media_task_runner_, "audio", audio_demuxer_stream, | 335 main_task_runner_, media_task_runner_, "audio", audio_demuxer_stream, |
| 336 rpc_broker_, audio_rpc_handle, std::move(audio), | 336 rpc_broker_, audio_rpc_handle, std::move(audio), |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 // controller will cause this renderer to shut down shortly. | 666 // controller will cause this renderer to shut down shortly. |
| 667 if (state_ != STATE_ERROR) { | 667 if (state_ != STATE_ERROR) { |
| 668 state_ = STATE_ERROR; | 668 state_ = STATE_ERROR; |
| 669 main_task_runner_->PostTask( | 669 main_task_runner_->PostTask( |
| 670 FROM_HERE, base::Bind(&RendererController::OnRendererFatalError, | 670 FROM_HERE, base::Bind(&RendererController::OnRendererFatalError, |
| 671 controller_, stop_trigger)); | 671 controller_, stop_trigger)); |
| 672 } | 672 } |
| 673 | 673 |
| 674 data_flow_poll_timer_.Stop(); | 674 data_flow_poll_timer_.Stop(); |
| 675 | 675 |
| 676 // This renderer will be shut down shortly. To prevent breaking the pipeline, |
| 677 // just run the callback without reporting error. |
| 676 if (!init_workflow_done_callback_.is_null()) { | 678 if (!init_workflow_done_callback_.is_null()) { |
| 677 base::ResetAndReturn(&init_workflow_done_callback_) | 679 base::ResetAndReturn(&init_workflow_done_callback_).Run(PIPELINE_OK); |
| 678 .Run(PIPELINE_ERROR_INITIALIZATION_FAILED); | |
| 679 return; | 680 return; |
| 680 } | 681 } |
| 681 | 682 |
| 682 if (!flush_cb_.is_null()) | 683 if (!flush_cb_.is_null()) |
| 683 base::ResetAndReturn(&flush_cb_).Run(); | 684 base::ResetAndReturn(&flush_cb_).Run(); |
| 684 } | 685 } |
| 685 | 686 |
| 686 // static | 687 // static |
| 687 void CourierRenderer::RequestUpdateInterstitialOnMainThread( | 688 void CourierRenderer::RequestUpdateInterstitialOnMainThread( |
| 688 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, | 689 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 kBytesPerKilobit; | 843 kBytesPerKilobit; |
| 843 DCHECK_GE(kilobits_per_second, 0); | 844 DCHECK_GE(kilobits_per_second, 0); |
| 844 const base::CheckedNumeric<int> checked_kbps = kilobits_per_second; | 845 const base::CheckedNumeric<int> checked_kbps = kilobits_per_second; |
| 845 metrics_recorder_.OnVideoRateEstimate( | 846 metrics_recorder_.OnVideoRateEstimate( |
| 846 checked_kbps.ValueOrDefault(std::numeric_limits<int>::max())); | 847 checked_kbps.ValueOrDefault(std::numeric_limits<int>::max())); |
| 847 } | 848 } |
| 848 } | 849 } |
| 849 | 850 |
| 850 } // namespace remoting | 851 } // namespace remoting |
| 851 } // namespace media | 852 } // namespace media |
| OLD | NEW |