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

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

Issue 19638008: Refactor GpuVideoDecoder::Factories out of GpuVideoDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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/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"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 timestamp(timestamp), 61 timestamp(timestamp),
62 width(width), 62 width(width),
63 height(height), 63 height(height),
64 size(size) {} 64 size(size) {}
65 65
66 RTCVideoDecoder::BufferData::BufferData() {} 66 RTCVideoDecoder::BufferData::BufferData() {}
67 67
68 RTCVideoDecoder::BufferData::~BufferData() {} 68 RTCVideoDecoder::BufferData::~BufferData() {}
69 69
70 RTCVideoDecoder::RTCVideoDecoder( 70 RTCVideoDecoder::RTCVideoDecoder(
71 const scoped_refptr<media::GpuVideoDecoder::Factories>& factories) 71 const scoped_refptr<media::GpuVideoDecoderFactories>& factories)
72 : weak_factory_(this), 72 : weak_factory_(this),
73 weak_this_(weak_factory_.GetWeakPtr()), 73 weak_this_(weak_factory_.GetWeakPtr()),
74 factories_(factories), 74 factories_(factories),
75 vda_loop_proxy_(factories_->GetMessageLoop()), 75 vda_loop_proxy_(factories_->GetMessageLoop()),
76 create_shm_thread_("CreateSHMThread"), 76 create_shm_thread_("CreateSHMThread"),
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),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Delete WebRTC input buffers. 121 // Delete WebRTC input buffers.
122 for (std::deque<std::pair<webrtc::EncodedImage, BufferData> >::iterator it = 122 for (std::deque<std::pair<webrtc::EncodedImage, BufferData> >::iterator it =
123 pending_buffers_.begin(); 123 pending_buffers_.begin();
124 it != pending_buffers_.end(); 124 it != pending_buffers_.end();
125 ++it) { 125 ++it) {
126 delete[] it->first._buffer; 126 delete[] it->first._buffer;
127 } 127 }
128 } 128 }
129 129
130 scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create( 130 scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create(
131 const scoped_refptr<media::GpuVideoDecoder::Factories>& factories) { 131 const scoped_refptr<media::GpuVideoDecoderFactories>& factories) {
132 scoped_ptr<RTCVideoDecoder> decoder(new RTCVideoDecoder(factories)); 132 scoped_ptr<RTCVideoDecoder> decoder(new RTCVideoDecoder(factories));
133 decoder->vda_.reset(factories->CreateVideoDecodeAccelerator( 133 decoder->vda_.reset(factories->CreateVideoDecodeAccelerator(
134 media::VP8PROFILE_MAIN, decoder.get())); 134 media::VP8PROFILE_MAIN, decoder.get()));
135 // vda can be NULL if VP8 is not supported. 135 // vda can be NULL if VP8 is not supported.
136 if (decoder->vda_ != NULL) { 136 if (decoder->vda_ != NULL) {
137 decoder->state_ = INITIALIZED; 137 decoder->state_ = INITIALIZED;
138 } else { 138 } else {
139 factories->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder.release()); 139 factories->GetMessageLoop()->DeleteSoon(FROM_HERE, decoder.release());
140 } 140 }
141 return decoder.Pass(); 141 return decoder.Pass();
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 0, // sync_point 387 0, // sync_point
388 media::BindToCurrentLoop( 388 media::BindToCurrentLoop(
389 base::Bind(&RTCVideoDecoder::ReusePictureBuffer, 389 base::Bind(&RTCVideoDecoder::ReusePictureBuffer,
390 weak_this_, 390 weak_this_,
391 picture.picture_buffer_id()))), 391 picture.picture_buffer_id()))),
392 decoder_texture_target_, 392 decoder_texture_target_,
393 pb.size(), 393 pb.size(),
394 visible_rect, 394 visible_rect,
395 natural_size, 395 natural_size,
396 timestamp_ms, 396 timestamp_ms,
397 base::Bind(&media::GpuVideoDecoder::Factories::ReadPixels, 397 base::Bind(&media::GpuVideoDecoderFactories::ReadPixels,
398 factories_, 398 factories_,
399 pb.texture_id(), 399 pb.texture_id(),
400 decoder_texture_target_, 400 decoder_texture_target_,
401 natural_size), 401 natural_size),
402 base::Closure()); 402 base::Closure());
403 } 403 }
404 404
405 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { 405 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) {
406 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; 406 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id;
407 DCHECK(vda_loop_proxy_->BelongsToCurrentThread()); 407 DCHECK(vda_loop_proxy_->BelongsToCurrentThread());
(...skipping 319 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

Powered by Google App Engine
This is Rietveld 408576698