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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // Create audio and video mojom::DemuxerStream and bind its lifetime to | 74 // Create audio and video mojom::DemuxerStream and bind its lifetime to |
75 // the pipe. | 75 // the pipe. |
76 DemuxerStream* const audio = | 76 DemuxerStream* const audio = |
77 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); | 77 demuxer_stream_provider_->GetStream(DemuxerStream::AUDIO); |
78 DemuxerStream* const video = | 78 DemuxerStream* const video = |
79 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); | 79 demuxer_stream_provider_->GetStream(DemuxerStream::VIDEO); |
80 | 80 |
81 mojom::DemuxerStreamPtr audio_stream; | 81 mojom::DemuxerStreamPtr audio_stream; |
82 if (audio) { | 82 if (audio) { |
83 audio_stream_.reset( | 83 audio_stream_.reset( |
84 new MojoDemuxerStreamImpl(audio, GetProxy(&audio_stream))); | 84 new MojoDemuxerStreamImpl(audio, MakeRequest(&audio_stream))); |
85 // Using base::Unretained(this) is safe because |this| owns | 85 // Using base::Unretained(this) is safe because |this| owns |
86 // |audio_stream_|, and the error handler can't be invoked once | 86 // |audio_stream_|, and the error handler can't be invoked once |
87 // |audio_stream_| is destroyed. | 87 // |audio_stream_| is destroyed. |
88 audio_stream_->set_connection_error_handler( | 88 audio_stream_->set_connection_error_handler( |
89 base::Bind(&MojoRenderer::OnDemuxerStreamConnectionError, | 89 base::Bind(&MojoRenderer::OnDemuxerStreamConnectionError, |
90 base::Unretained(this), DemuxerStream::AUDIO)); | 90 base::Unretained(this), DemuxerStream::AUDIO)); |
91 } | 91 } |
92 | 92 |
93 mojom::DemuxerStreamPtr video_stream; | 93 mojom::DemuxerStreamPtr video_stream; |
94 if (video) { | 94 if (video) { |
95 video_stream_.reset( | 95 video_stream_.reset( |
96 new MojoDemuxerStreamImpl(video, GetProxy(&video_stream))); | 96 new MojoDemuxerStreamImpl(video, MakeRequest(&video_stream))); |
97 // Using base::Unretained(this) is safe because |this| owns | 97 // Using base::Unretained(this) is safe because |this| owns |
98 // |video_stream_|, and the error handler can't be invoked once | 98 // |video_stream_|, and the error handler can't be invoked once |
99 // |video_stream_| is destroyed. | 99 // |video_stream_| is destroyed. |
100 video_stream_->set_connection_error_handler( | 100 video_stream_->set_connection_error_handler( |
101 base::Bind(&MojoRenderer::OnDemuxerStreamConnectionError, | 101 base::Bind(&MojoRenderer::OnDemuxerStreamConnectionError, |
102 base::Unretained(this), DemuxerStream::VIDEO)); | 102 base::Unretained(this), DemuxerStream::VIDEO)); |
103 } | 103 } |
104 | 104 |
105 BindRemoteRendererIfNeeded(); | 105 BindRemoteRendererIfNeeded(); |
106 | 106 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); | 387 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); |
388 | 388 |
389 if (!flush_cb_.is_null()) | 389 if (!flush_cb_.is_null()) |
390 base::ResetAndReturn(&flush_cb_).Run(); | 390 base::ResetAndReturn(&flush_cb_).Run(); |
391 | 391 |
392 if (!cdm_attached_cb_.is_null()) | 392 if (!cdm_attached_cb_.is_null()) |
393 base::ResetAndReturn(&cdm_attached_cb_).Run(false); | 393 base::ResetAndReturn(&cdm_attached_cb_).Run(false); |
394 } | 394 } |
395 | 395 |
396 } // namespace media | 396 } // namespace media |
OLD | NEW |