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

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

Issue 23125008: Revert 217691 "Merge 217276 "Add media::VideoEncodeAccelerator w..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 4 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/safe_numerics.h" 11 #include "base/safe_numerics.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/task_runner_util.h" 13 #include "base/task_runner_util.h"
14 #include "content/child/child_thread.h" 14 #include "content/child/child_thread.h"
15 #include "media/base/bind_to_loop.h" 15 #include "media/base/bind_to_loop.h"
16 #include "media/filters/gpu_video_accelerator_factories.h" 16 #include "media/filters/gpu_video_decoder_factories.h"
17 #include "third_party/webrtc/system_wrappers/interface/ref_count.h" 17 #include "third_party/webrtc/system_wrappers/interface/ref_count.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 const int32 RTCVideoDecoder::ID_LAST = 0x3FFFFFFF; 21 const int32 RTCVideoDecoder::ID_LAST = 0x3FFFFFFF;
22 const int32 RTCVideoDecoder::ID_HALF = 0x20000000; 22 const int32 RTCVideoDecoder::ID_HALF = 0x20000000;
23 const int32 RTCVideoDecoder::ID_INVALID = -1; 23 const int32 RTCVideoDecoder::ID_INVALID = -1;
24 24
25 // Maximum number of concurrent VDA::Decode() operations RVD will maintain. 25 // Maximum number of concurrent VDA::Decode() operations RVD will maintain.
26 // Higher values allow better pipelining in the GPU, but also require more 26 // Higher values allow better pipelining in the GPU, but also require more
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 timestamp(timestamp), 62 timestamp(timestamp),
63 width(width), 63 width(width),
64 height(height), 64 height(height),
65 size(size) {} 65 size(size) {}
66 66
67 RTCVideoDecoder::BufferData::BufferData() {} 67 RTCVideoDecoder::BufferData::BufferData() {}
68 68
69 RTCVideoDecoder::BufferData::~BufferData() {} 69 RTCVideoDecoder::BufferData::~BufferData() {}
70 70
71 RTCVideoDecoder::RTCVideoDecoder( 71 RTCVideoDecoder::RTCVideoDecoder(
72 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories) 72 const scoped_refptr<media::GpuVideoDecoderFactories>& factories)
73 : weak_factory_(this), 73 : weak_factory_(this),
74 weak_this_(weak_factory_.GetWeakPtr()), 74 weak_this_(weak_factory_.GetWeakPtr()),
75 factories_(factories), 75 factories_(factories),
76 vda_loop_proxy_(factories->GetMessageLoop()), 76 vda_loop_proxy_(factories->GetMessageLoop()),
77 decoder_texture_target_(0), 77 decoder_texture_target_(0),
78 next_picture_buffer_id_(0), 78 next_picture_buffer_id_(0),
79 state_(UNINITIALIZED), 79 state_(UNINITIALIZED),
80 decode_complete_callback_(NULL), 80 decode_complete_callback_(NULL),
81 num_shm_buffers_(0), 81 num_shm_buffers_(0),
82 next_bitstream_buffer_id_(0), 82 next_bitstream_buffer_id_(0),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 for (std::deque<std::pair<webrtc::EncodedImage, BufferData> >::iterator it = 115 for (std::deque<std::pair<webrtc::EncodedImage, BufferData> >::iterator it =
116 pending_buffers_.begin(); 116 pending_buffers_.begin();
117 it != pending_buffers_.end(); 117 it != pending_buffers_.end();
118 ++it) { 118 ++it) {
119 delete[] it->first._buffer; 119 delete[] it->first._buffer;
120 } 120 }
121 } 121 }
122 122
123 scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create( 123 scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create(
124 webrtc::VideoCodecType type, 124 webrtc::VideoCodecType type,
125 const scoped_refptr<media::GpuVideoAcceleratorFactories>& factories) { 125 const scoped_refptr<media::GpuVideoDecoderFactories>& factories) {
126 scoped_ptr<RTCVideoDecoder> decoder; 126 scoped_ptr<RTCVideoDecoder> decoder;
127 // Convert WebRTC codec type to media codec profile. 127 // Convert WebRTC codec type to media codec profile.
128 media::VideoCodecProfile profile; 128 media::VideoCodecProfile profile;
129 switch (type) { 129 switch (type) {
130 case webrtc::kVideoCodecVP8: 130 case webrtc::kVideoCodecVP8:
131 profile = media::VP8PROFILE_MAIN; 131 profile = media::VP8PROFILE_MAIN;
132 break; 132 break;
133 default: 133 default:
134 DVLOG(2) << "Video codec not supported:" << type; 134 DVLOG(2) << "Video codec not supported:" << type;
135 return decoder.Pass(); 135 return decoder.Pass();
136 } 136 }
137 137
138 decoder.reset(new RTCVideoDecoder(factories)); 138 decoder.reset(new RTCVideoDecoder(factories));
139 decoder->vda_ = 139 decoder->vda_
140 factories->CreateVideoDecodeAccelerator(profile, decoder.get()).Pass(); 140 .reset(factories->CreateVideoDecodeAccelerator(profile, decoder.get()));
141 // vda can be NULL if VP8 is not supported. 141 // vda can be NULL if VP8 is not supported.
142 if (decoder->vda_ != NULL) { 142 if (decoder->vda_ != NULL) {
143 decoder->state_ = INITIALIZED; 143 decoder->state_ = INITIALIZED;
144 } else { 144 } else {
145 factories->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder.release()); 145 factories->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder.release());
146 } 146 }
147 return decoder.Pass(); 147 return decoder.Pass();
148 } 148 }
149 149
150 int32_t RTCVideoDecoder::InitDecode(const webrtc::VideoCodec* codecSettings, 150 int32_t RTCVideoDecoder::InitDecode(const webrtc::VideoCodec* codecSettings,
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 0, // sync_point 390 0, // sync_point
391 media::BindToCurrentLoop( 391 media::BindToCurrentLoop(
392 base::Bind(&RTCVideoDecoder::ReusePictureBuffer, 392 base::Bind(&RTCVideoDecoder::ReusePictureBuffer,
393 weak_this_, 393 weak_this_,
394 picture.picture_buffer_id()))), 394 picture.picture_buffer_id()))),
395 decoder_texture_target_, 395 decoder_texture_target_,
396 pb.size(), 396 pb.size(),
397 visible_rect, 397 visible_rect,
398 natural_size, 398 natural_size,
399 timestamp_ms, 399 timestamp_ms,
400 base::Bind(&media::GpuVideoAcceleratorFactories::ReadPixels, 400 base::Bind(&media::GpuVideoDecoderFactories::ReadPixels,
401 factories_, 401 factories_,
402 pb.texture_id(), 402 pb.texture_id(),
403 decoder_texture_target_, 403 decoder_texture_target_,
404 natural_size), 404 natural_size),
405 base::Closure()); 405 base::Closure());
406 } 406 }
407 407
408 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { 408 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) {
409 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; 409 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id;
410 DCHECK(vda_loop_proxy_->BelongsToCurrentThread()); 410 DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 continue; 727 continue;
728 *timestamp = it->timestamp; 728 *timestamp = it->timestamp;
729 *width = it->width; 729 *width = it->width;
730 *height = it->height; 730 *height = it->height;
731 return; 731 return;
732 } 732 }
733 NOTREACHED() << "Missing bitstream buffer id: " << bitstream_buffer_id; 733 NOTREACHED() << "Missing bitstream buffer id: " << bitstream_buffer_id;
734 } 734 }
735 735
736 } // namespace content 736 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_video_decoder.h ('k') | content/renderer/media/rtc_video_decoder_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698