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

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

Issue 990913002: RTCVideoDecoder: Using I420VideoFrame directly instead of to-be-removed TextureVideoFrame (previous… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/task_runner_util.h" 15 #include "base/task_runner_util.h"
16 #include "content/renderer/media/native_handle_impl.h" 16 #include "content/renderer/media/native_handle_impl.h"
17 #include "gpu/command_buffer/common/mailbox_holder.h" 17 #include "gpu/command_buffer/common/mailbox_holder.h"
18 #include "media/base/bind_to_current_loop.h" 18 #include "media/base/bind_to_current_loop.h"
19 #include "media/renderers/gpu_video_accelerator_factories.h" 19 #include "media/renderers/gpu_video_accelerator_factories.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "third_party/webrtc/common_video/interface/texture_video_frame.h" 21 #include "third_party/webrtc/common_video/interface/i420_video_frame.h"
magjed_chromium 2015/03/09 13:20:24 I think you should use "webrtc/video_frame.h" inst
22 #include "third_party/webrtc/system_wrappers/interface/ref_count.h" 22 #include "third_party/webrtc/system_wrappers/interface/ref_count.h"
23 23
24 namespace content { 24 namespace content {
25 25
26 const int32 RTCVideoDecoder::ID_LAST = 0x3FFFFFFF; 26 const int32 RTCVideoDecoder::ID_LAST = 0x3FFFFFFF;
27 const int32 RTCVideoDecoder::ID_HALF = 0x20000000; 27 const int32 RTCVideoDecoder::ID_HALF = 0x20000000;
28 const int32 RTCVideoDecoder::ID_INVALID = -1; 28 const int32 RTCVideoDecoder::ID_INVALID = -1;
29 29
30 // Maximum number of concurrent VDA::Decode() operations RVD will maintain. 30 // Maximum number of concurrent VDA::Decode() operations RVD will maintain.
31 // Higher values allow better pipelining in the GPU, but also require more 31 // Higher values allow better pipelining in the GPU, but also require more
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 CreateVideoFrame(picture, pb, timestamp); 383 CreateVideoFrame(picture, pb, timestamp);
384 bool inserted = 384 bool inserted =
385 picture_buffers_at_display_.insert(std::make_pair( 385 picture_buffers_at_display_.insert(std::make_pair(
386 picture.picture_buffer_id(), 386 picture.picture_buffer_id(),
387 pb.texture_id())).second; 387 pb.texture_id())).second;
388 DCHECK(inserted); 388 DCHECK(inserted);
389 389
390 // Create a WebRTC video frame. 390 // Create a WebRTC video frame.
391 webrtc::RefCountImpl<NativeHandleImpl>* handle = 391 webrtc::RefCountImpl<NativeHandleImpl>* handle =
392 new webrtc::RefCountImpl<NativeHandleImpl>(frame); 392 new webrtc::RefCountImpl<NativeHandleImpl>(frame);
393 webrtc::TextureVideoFrame decoded_image(handle, 393 webrtc::I420VideoFrame decoded_image(handle,
394 picture.visible_rect().width(), 394 picture.visible_rect().width(),
395 picture.visible_rect().height(), 395 picture.visible_rect().height(),
396 timestamp, 396 timestamp,
397 0); 397 0);
398 398
399 // Invoke decode callback. WebRTC expects no callback after Reset or Release. 399 // Invoke decode callback. WebRTC expects no callback after Reset or Release.
400 { 400 {
401 base::AutoLock auto_lock(lock_); 401 base::AutoLock auto_lock(lock_);
402 DCHECK(decode_complete_callback_ != NULL); 402 DCHECK(decode_complete_callback_ != NULL);
403 if (IsBufferAfterReset(picture.bitstream_buffer_id(), 403 if (IsBufferAfterReset(picture.bitstream_buffer_id(),
404 reset_bitstream_buffer_id_)) { 404 reset_bitstream_buffer_id_)) {
405 decode_complete_callback_->Decoded(decoded_image); 405 decode_complete_callback_->Decoded(decoded_image);
406 } 406 }
407 } 407 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); 776 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample);
777 return status; 777 return status;
778 } 778 }
779 779
780 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 780 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
781 const { 781 const {
782 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 782 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
783 } 783 }
784 784
785 } // namespace content 785 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698