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

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

Issue 1083883003: Move BindToCurrentLoop from media/base/ to base/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix media/base/callback_holder.h compile Created 5 years, 8 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/rtc_video_decoder.h" 5 #include "content/renderer/media/rtc_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_to_current_loop.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/numerics/safe_conversions.h" 13 #include "base/numerics/safe_conversions.h"
13 #include "base/stl_util.h" 14 #include "base/stl_util.h"
14 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
15 #include "base/task_runner_util.h" 16 #include "base/task_runner_util.h"
16 #include "gpu/command_buffer/common/mailbox_holder.h" 17 #include "gpu/command_buffer/common/mailbox_holder.h"
17 #include "media/base/bind_to_current_loop.h"
18 #include "media/renderers/gpu_video_accelerator_factories.h" 18 #include "media/renderers/gpu_video_accelerator_factories.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 #include "third_party/webrtc/base/bind.h" 20 #include "third_party/webrtc/base/bind.h"
21 #include "third_party/webrtc/system_wrappers/interface/ref_count.h" 21 #include "third_party/webrtc/system_wrappers/interface/ref_count.h"
22 #include "third_party/webrtc/video_frame.h" 22 #include "third_party/webrtc/video_frame.h"
23 23
24 static void ReleaseFrame(scoped_refptr<media::VideoFrame> frame) { 24 static void ReleaseFrame(scoped_refptr<media::VideoFrame> frame) {
25 } 25 }
26 26
27 namespace content { 27 namespace content {
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 const media::PictureBuffer& pb, 415 const media::PictureBuffer& pb,
416 uint32_t timestamp) { 416 uint32_t timestamp) {
417 gfx::Rect visible_rect(picture.visible_rect()); 417 gfx::Rect visible_rect(picture.visible_rect());
418 DCHECK(decoder_texture_target_); 418 DCHECK(decoder_texture_target_);
419 // Convert timestamp from 90KHz to ms. 419 // Convert timestamp from 90KHz to ms.
420 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue( 420 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
421 base::checked_cast<uint64_t>(timestamp) * 1000 / 90); 421 base::checked_cast<uint64_t>(timestamp) * 1000 / 90);
422 return media::VideoFrame::WrapNativeTexture( 422 return media::VideoFrame::WrapNativeTexture(
423 make_scoped_ptr(new gpu::MailboxHolder(pb.texture_mailbox(), 423 make_scoped_ptr(new gpu::MailboxHolder(pb.texture_mailbox(),
424 decoder_texture_target_, 0)), 424 decoder_texture_target_, 0)),
425 media::BindToCurrentLoop(base::Bind( 425 base::BindToCurrentLoop(base::Bind(
426 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), 426 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(),
427 factories_, picture.picture_buffer_id(), pb.texture_id())), 427 factories_, picture.picture_buffer_id(), pb.texture_id())),
428 pb.size(), visible_rect, visible_rect.size(), timestamp_ms, 428 pb.size(), visible_rect, visible_rect.size(), timestamp_ms,
429 picture.allow_overlay()); 429 picture.allow_overlay());
430 } 430 }
431 431
432 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { 432 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) {
433 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; 433 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id;
434 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 434 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
435 435
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); 779 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample);
780 return status; 780 return status;
781 } 781 }
782 782
783 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 783 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
784 const { 784 const {
785 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 785 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
786 } 786 }
787 787
788 } // namespace content 788 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_video_sink.cc ('k') | content/renderer/media/rtc_video_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698