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

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

Issue 141113003: Refactor base/safe_numerics.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/safe_numerics.h" 12 #include "base/numerics/safe_conversions.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/task_runner_util.h" 14 #include "base/task_runner_util.h"
15 #include "content/child/child_thread.h" 15 #include "content/child/child_thread.h"
16 #include "content/renderer/media/native_handle_impl.h" 16 #include "content/renderer/media/native_handle_impl.h"
17 #include "media/base/bind_to_current_loop.h" 17 #include "media/base/bind_to_current_loop.h"
18 #include "media/filters/gpu_video_accelerator_factories.h" 18 #include "media/filters/gpu_video_accelerator_factories.h"
19 #include "third_party/webrtc/common_video/interface/texture_video_frame.h" 19 #include "third_party/webrtc/common_video/interface/texture_video_frame.h"
20 #include "third_party/webrtc/system_wrappers/interface/ref_count.h" 20 #include "third_party/webrtc/system_wrappers/interface/ref_count.h"
21 21
22 namespace content { 22 namespace content {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 const media::PictureBuffer& pb, 411 const media::PictureBuffer& pb,
412 uint32_t timestamp, 412 uint32_t timestamp,
413 uint32_t width, 413 uint32_t width,
414 uint32_t height, 414 uint32_t height,
415 size_t size) { 415 size_t size) {
416 gfx::Rect visible_rect(width, height); 416 gfx::Rect visible_rect(width, height);
417 gfx::Size natural_size(width, height); 417 gfx::Size natural_size(width, height);
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_numeric_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 media::VideoFrame::MailboxHolder( 423 make_scoped_ptr(new media::VideoFrame::MailboxHolder(
424 pb.texture_mailbox(), 424 pb.texture_mailbox(),
425 0, // sync_point 425 0, // sync_point
426 media::BindToCurrentLoop( 426 media::BindToCurrentLoop(
427 base::Bind(&RTCVideoDecoder::ReusePictureBuffer, 427 base::Bind(&RTCVideoDecoder::ReusePictureBuffer,
428 weak_this_, 428 weak_this_,
429 picture.picture_buffer_id())))), 429 picture.picture_buffer_id())))),
430 decoder_texture_target_, 430 decoder_texture_target_,
431 pb.size(), 431 pb.size(),
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 778
779 int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) { 779 int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) {
780 // Logging boolean is enough to know if HW decoding has been used. Also, 780 // Logging boolean is enough to know if HW decoding has been used. Also,
781 // InitDecode is less likely to return an error so enum is not used here. 781 // InitDecode is less likely to return an error so enum is not used here.
782 bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false; 782 bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false;
783 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); 783 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample);
784 return status; 784 return status;
785 } 785 }
786 786
787 } // namespace content 787 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_encode_accelerator_unittest.cc ('k') | content/renderer/pepper/content_decryptor_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698