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/services/mojo_renderer_service.h" | 5 #include "media/mojo/services/mojo_renderer_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/optional.h" | 10 #include "base/optional.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 weak_this_ = weak_factory_.GetWeakPtr(); | 62 weak_this_ = weak_factory_.GetWeakPtr(); |
63 } | 63 } |
64 | 64 |
65 MojoRendererService::~MojoRendererService() {} | 65 MojoRendererService::~MojoRendererService() {} |
66 | 66 |
67 void MojoRendererService::Initialize( | 67 void MojoRendererService::Initialize( |
68 mojom::RendererClientAssociatedPtrInfo client, | 68 mojom::RendererClientAssociatedPtrInfo client, |
69 mojom::DemuxerStreamPtr audio, | 69 mojom::DemuxerStreamPtr audio, |
70 mojom::DemuxerStreamPtr video, | 70 mojom::DemuxerStreamPtr video, |
71 const base::Optional<GURL>& url, | 71 const base::Optional<GURL>& media_url, |
| 72 const base::Optional<GURL>& first_party_for_cookies, |
72 const InitializeCallback& callback) { | 73 const InitializeCallback& callback) { |
73 DVLOG(1) << __FUNCTION__; | 74 DVLOG(1) << __FUNCTION__; |
74 DCHECK_EQ(state_, STATE_UNINITIALIZED); | 75 DCHECK_EQ(state_, STATE_UNINITIALIZED); |
75 | 76 |
76 client_.Bind(std::move(client)); | 77 client_.Bind(std::move(client)); |
77 state_ = STATE_INITIALIZING; | 78 state_ = STATE_INITIALIZING; |
78 | 79 |
79 if (url == base::nullopt) { | 80 if (media_url == base::nullopt) { |
80 stream_provider_.reset(new DemuxerStreamProviderShim( | 81 stream_provider_.reset(new DemuxerStreamProviderShim( |
81 std::move(audio), std::move(video), | 82 std::move(audio), std::move(video), |
82 base::Bind(&MojoRendererService::OnStreamReady, weak_this_, callback))); | 83 base::Bind(&MojoRendererService::OnStreamReady, weak_this_, callback))); |
83 return; | 84 return; |
84 } | 85 } |
85 | 86 |
86 DCHECK(!audio); | 87 DCHECK(!audio); |
87 DCHECK(!video); | 88 DCHECK(!video); |
88 DCHECK(!url.value().is_empty()); | 89 DCHECK(!media_url.value().is_empty()); |
89 stream_provider_.reset(new MediaUrlDemuxer(nullptr, url.value())); | 90 DCHECK(first_party_for_cookies); |
| 91 stream_provider_.reset(new MediaUrlDemuxer(nullptr, media_url.value(), |
| 92 first_party_for_cookies.value())); |
90 renderer_->Initialize( | 93 renderer_->Initialize( |
91 stream_provider_.get(), this, | 94 stream_provider_.get(), this, |
92 base::Bind(&MojoRendererService::OnRendererInitializeDone, weak_this_, | 95 base::Bind(&MojoRendererService::OnRendererInitializeDone, weak_this_, |
93 callback)); | 96 callback)); |
94 } | 97 } |
95 | 98 |
96 void MojoRendererService::Flush(const FlushCallback& callback) { | 99 void MojoRendererService::Flush(const FlushCallback& callback) { |
97 DVLOG(2) << __FUNCTION__; | 100 DVLOG(2) << __FUNCTION__; |
98 DCHECK_EQ(state_, STATE_PLAYING); | 101 DCHECK_EQ(state_, STATE_PLAYING); |
99 | 102 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // |renderer_| is likely not of type MediaPlayerRenderer. | 271 // |renderer_| is likely not of type MediaPlayerRenderer. |
269 // This is an unexpected call, and the connection should be closed. | 272 // This is an unexpected call, and the connection should be closed. |
270 mojo::ReportBadMessage("Unexpected call to InitiateScopedSurfaceRequest."); | 273 mojo::ReportBadMessage("Unexpected call to InitiateScopedSurfaceRequest."); |
271 binding_->Close(); | 274 binding_->Close(); |
272 return; | 275 return; |
273 } | 276 } |
274 | 277 |
275 callback.Run(initiate_surface_request_cb_.Run()); | 278 callback.Run(initiate_surface_request_cb_.Run()); |
276 } | 279 } |
277 } // namespace media | 280 } // namespace media |
OLD | NEW |