Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: content/browser/media/android/media_player_renderer.cc

Issue 2668393002: Rename DemuxerStreamProvider into MediaResource (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/media/android/media_player_renderer.h" 5 #include "content/browser/media/android/media_player_renderer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "content/browser/android/scoped_surface_request_manager.h" 10 #include "content/browser/android/scoped_surface_request_manager.h"
(...skipping 22 matching lines...) Expand all
33 MediaPlayerRenderer::MediaPlayerRenderer(RenderFrameHost* render_frame_host) 33 MediaPlayerRenderer::MediaPlayerRenderer(RenderFrameHost* render_frame_host)
34 : render_frame_host_(render_frame_host), 34 : render_frame_host_(render_frame_host),
35 duration_(media::kInfiniteDuration), 35 duration_(media::kInfiniteDuration),
36 has_error_(false), 36 has_error_(false),
37 weak_factory_(this) {} 37 weak_factory_(this) {}
38 38
39 MediaPlayerRenderer::~MediaPlayerRenderer() { 39 MediaPlayerRenderer::~MediaPlayerRenderer() {
40 CancelScopedSurfaceRequest(); 40 CancelScopedSurfaceRequest();
41 } 41 }
42 42
43 void MediaPlayerRenderer::Initialize( 43 void MediaPlayerRenderer::Initialize(media::MediaResource* media_resource,
44 media::DemuxerStreamProvider* demuxer_stream_provider, 44 media::RendererClient* client,
45 media::RendererClient* client, 45 const media::PipelineStatusCB& init_cb) {
46 const media::PipelineStatusCB& init_cb) {
47 DVLOG(1) << __func__; 46 DVLOG(1) << __func__;
48 47
49 DCHECK_CURRENTLY_ON(BrowserThread::UI); 48 DCHECK_CURRENTLY_ON(BrowserThread::UI);
50 49
51 renderer_client_ = client; 50 renderer_client_ = client;
52 51
53 if (demuxer_stream_provider->GetType() != 52 if (media_resource->GetType() != media::MediaResource::Type::URL) {
54 media::DemuxerStreamProvider::Type::URL) { 53 DLOG(ERROR) << "MediaResource is not of Type URL";
55 DLOG(ERROR) << "DemuxerStreamProvider is not of Type URL";
56 init_cb.Run(media::PIPELINE_ERROR_INITIALIZATION_FAILED); 54 init_cb.Run(media::PIPELINE_ERROR_INITIALIZATION_FAILED);
57 return; 55 return;
58 } 56 }
59 57
60 base::TimeDelta creation_delay = 58 base::TimeDelta creation_delay =
61 media::MediaServiceThrottler::GetInstance()->GetDelayForClientCreation(); 59 media::MediaServiceThrottler::GetInstance()->GetDelayForClientCreation();
62 60
63 if (creation_delay.is_zero()) { 61 if (creation_delay.is_zero()) {
64 CreateMediaPlayer(demuxer_stream_provider->GetMediaUrlParams(), init_cb); 62 CreateMediaPlayer(media_resource->GetMediaUrlParams(), init_cb);
65 return; 63 return;
66 } 64 }
67 65
68 BrowserThread::PostDelayedTask( 66 BrowserThread::PostDelayedTask(
69 BrowserThread::UI, FROM_HERE, 67 BrowserThread::UI, FROM_HERE,
70 base::Bind(&MediaPlayerRenderer::CreateMediaPlayer, 68 base::Bind(&MediaPlayerRenderer::CreateMediaPlayer,
71 weak_factory_.GetWeakPtr(), 69 weak_factory_.GetWeakPtr(),
72 demuxer_stream_provider->GetMediaUrlParams(), init_cb), 70 media_resource->GetMediaUrlParams(), init_cb),
73 creation_delay); 71 creation_delay);
74 } 72 }
75 73
76 void MediaPlayerRenderer::CreateMediaPlayer( 74 void MediaPlayerRenderer::CreateMediaPlayer(
77 const media::MediaUrlParams& url_params, 75 const media::MediaUrlParams& url_params,
78 const media::PipelineStatusCB& init_cb) { 76 const media::PipelineStatusCB& init_cb) {
79 DCHECK_CURRENTLY_ON(BrowserThread::UI); 77 DCHECK_CURRENTLY_ON(BrowserThread::UI);
80 78
81 const std::string user_agent = GetContentClient()->GetUserAgent(); 79 const std::string user_agent = GetContentClient()->GetUserAgent();
82 80
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void MediaPlayerRenderer::CancelScopedSurfaceRequest() { 269 void MediaPlayerRenderer::CancelScopedSurfaceRequest() {
272 if (!surface_request_token_) 270 if (!surface_request_token_)
273 return; 271 return;
274 272
275 ScopedSurfaceRequestManager::GetInstance()->UnregisterScopedSurfaceRequest( 273 ScopedSurfaceRequestManager::GetInstance()->UnregisterScopedSurfaceRequest(
276 surface_request_token_); 274 surface_request_token_);
277 surface_request_token_ = base::UnguessableToken(); 275 surface_request_token_ = base::UnguessableToken();
278 } 276 }
279 277
280 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698