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

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 480233007: Remove implicit conversions from scoped_refptr to T* in content/renderer/media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/media/webmediaplayer_impl.h" 5 #include "content/renderer/media/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnNaturalSizeChanged), 207 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnNaturalSizeChanged),
208 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnOpacityChanged))), 208 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnOpacityChanged))),
209 text_track_index_(0), 209 text_track_index_(0),
210 web_cdm_(NULL) { 210 web_cdm_(NULL) {
211 media_log_->AddEvent( 211 media_log_->AddEvent(
212 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 212 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
213 213
214 // |gpu_factories_| requires that its entry points be called on its 214 // |gpu_factories_| requires that its entry points be called on its
215 // |GetTaskRunner()|. Since |pipeline_| will own decoders created from the 215 // |GetTaskRunner()|. Since |pipeline_| will own decoders created from the
216 // factories, require that their message loops are identical. 216 // factories, require that their message loops are identical.
217 DCHECK(!gpu_factories_ || (gpu_factories_->GetTaskRunner() == media_loop_)); 217 DCHECK(!gpu_factories_.get() ||
218 (gpu_factories_->GetTaskRunner() == media_loop_.get()));
218 219
219 // Let V8 know we started new thread if we did not do it yet. 220 // Let V8 know we started new thread if we did not do it yet.
220 // Made separate task to avoid deletion of player currently being created. 221 // Made separate task to avoid deletion of player currently being created.
221 // Also, delaying GC until after player starts gets rid of starting lag -- 222 // Also, delaying GC until after player starts gets rid of starting lag --
222 // collection happens in parallel with playing. 223 // collection happens in parallel with playing.
223 // 224 //
224 // TODO(enal): remove when we get rid of per-audio-stream thread. 225 // TODO(enal): remove when we get rid of per-audio-stream thread.
225 main_loop_->PostTask( 226 main_loop_->PostTask(
226 FROM_HERE, 227 FROM_HERE,
227 base::Bind(&WebMediaPlayerImpl::IncrementExternallyAllocatedMemory, 228 base::Bind(&WebMediaPlayerImpl::IncrementExternallyAllocatedMemory,
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 unsigned int level, 624 unsigned int level,
624 unsigned int internal_format, 625 unsigned int internal_format,
625 unsigned int type, 626 unsigned int type,
626 bool premultiply_alpha, 627 bool premultiply_alpha,
627 bool flip_y) { 628 bool flip_y) {
628 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 629 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
629 630
630 scoped_refptr<media::VideoFrame> video_frame = 631 scoped_refptr<media::VideoFrame> video_frame =
631 GetCurrentFrameFromCompositor(); 632 GetCurrentFrameFromCompositor();
632 633
633 if (!video_frame) 634 if (!video_frame.get())
634 return false; 635 return false;
635 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE) 636 if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
636 return false; 637 return false;
637 638
638 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); 639 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder();
639 if (mailbox_holder->texture_target != GL_TEXTURE_2D) 640 if (mailbox_holder->texture_target != GL_TEXTURE_2D)
640 return false; 641 return false;
641 642
642 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point); 643 web_graphics_context->waitSyncPoint(mailbox_holder->sync_point);
643 uint32 source_texture = web_graphics_context->createAndConsumeTextureCHROMIUM( 644 uint32 source_texture = web_graphics_context->createAndConsumeTextureCHROMIUM(
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 compositor_task_runner_->PostTask(FROM_HERE, 1424 compositor_task_runner_->PostTask(FROM_HERE,
1424 base::Bind(&GetCurrentFrameAndSignal, 1425 base::Bind(&GetCurrentFrameAndSignal,
1425 base::Unretained(compositor_), 1426 base::Unretained(compositor_),
1426 &video_frame, 1427 &video_frame,
1427 &event)); 1428 &event));
1428 event.Wait(); 1429 event.Wait();
1429 return video_frame; 1430 return video_frame;
1430 } 1431 }
1431 1432
1432 } // namespace content 1433 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_track_adapter.cc ('k') | content/renderer/media/webmediaplayer_ms.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698