| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mojo/clients/mojo_renderer.h" | 5 #include "media/mojo/clients/mojo_renderer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void MojoRenderer::InitializeRendererFromStreams( | 69 void MojoRenderer::InitializeRendererFromStreams( |
| 70 media::RendererClient* client) { | 70 media::RendererClient* client) { |
| 71 DVLOG(1) << __func__; | 71 DVLOG(1) << __func__; |
| 72 DCHECK(task_runner_->BelongsToCurrentThread()); | 72 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 73 | 73 |
| 74 // Create mojom::DemuxerStream for each demuxer stream and bind its lifetime | 74 // Create mojom::DemuxerStream for each demuxer stream and bind its lifetime |
| 75 // to the pipe. | 75 // to the pipe. |
| 76 std::vector<DemuxerStream*> streams = media_resource_->GetAllStreams(); | 76 std::vector<DemuxerStream*> streams = media_resource_->GetAllStreams(); |
| 77 std::vector<mojom::DemuxerStreamPtr> stream_proxies; | 77 std::vector<mojom::DemuxerStreamPtr> stream_proxies; |
| 78 | 78 |
| 79 for (auto* stream : streams) { | 79 for (const auto& stream : streams) { |
| 80 mojom::DemuxerStreamPtr stream_proxy; | 80 mojom::DemuxerStreamPtr stream_proxy; |
| 81 std::unique_ptr<MojoDemuxerStreamImpl> mojo_stream = | 81 std::unique_ptr<MojoDemuxerStreamImpl> mojo_stream = |
| 82 base::MakeUnique<MojoDemuxerStreamImpl>(stream, | 82 base::MakeUnique<MojoDemuxerStreamImpl>(stream, |
| 83 MakeRequest(&stream_proxy)); | 83 MakeRequest(&stream_proxy)); |
| 84 | 84 |
| 85 // Using base::Unretained(this) is safe because |this| owns |mojo_stream|, | 85 // Using base::Unretained(this) is safe because |this| owns |mojo_stream|, |
| 86 // and the error handler can't be invoked once |mojo_stream| is destroyed. | 86 // and the error handler can't be invoked once |mojo_stream| is destroyed. |
| 87 mojo_stream->set_connection_error_handler( | 87 mojo_stream->set_connection_error_handler( |
| 88 base::Bind(&MojoRenderer::OnDemuxerStreamConnectionError, | 88 base::Bind(&MojoRenderer::OnDemuxerStreamConnectionError, |
| 89 base::Unretained(this), mojo_stream.get())); | 89 base::Unretained(this), mojo_stream.get())); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); | 378 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); |
| 379 | 379 |
| 380 if (!flush_cb_.is_null()) | 380 if (!flush_cb_.is_null()) |
| 381 base::ResetAndReturn(&flush_cb_).Run(); | 381 base::ResetAndReturn(&flush_cb_).Run(); |
| 382 | 382 |
| 383 if (!cdm_attached_cb_.is_null()) | 383 if (!cdm_attached_cb_.is_null()) |
| 384 base::ResetAndReturn(&cdm_attached_cb_).Run(false); | 384 base::ResetAndReturn(&cdm_attached_cb_).Run(false); |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace media | 387 } // namespace media |
| OLD | NEW |