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

Side by Side Diff: media/filters/gpu_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
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/gpu_video_decoder_factories.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/cpu.h" 11 #include "base/cpu.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.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 "media/base/bind_to_loop.h" 15 #include "media/base/bind_to_loop.h"
16 #include "media/base/decoder_buffer.h" 16 #include "media/base/decoder_buffer.h"
17 #include "media/base/pipeline.h" 17 #include "media/base/pipeline.h"
18 #include "media/base/pipeline_status.h" 18 #include "media/base/pipeline_status.h"
19 #include "media/base/video_decoder_config.h" 19 #include "media/base/video_decoder_config.h"
20 #include "media/filters/gpu_video_accelerator_factories.h" 20 #include "media/filters/gpu_video_decoder_factories.h"
21 21
22 namespace media { 22 namespace media {
23 23
24 // Maximum number of concurrent VDA::Decode() operations GVD will maintain. 24 // Maximum number of concurrent VDA::Decode() operations GVD will maintain.
25 // Higher values allow better pipelining in the GPU, but also require more 25 // Higher values allow better pipelining in the GPU, but also require more
26 // resources. 26 // resources.
27 enum { kMaxInFlightDecodes = 4 }; 27 enum { kMaxInFlightDecodes = 4 };
28 28
29 // Size of shared-memory segments we allocate. Since we reuse them we let them 29 // Size of shared-memory segments we allocate. Since we reuse them we let them
30 // be on the beefy side. 30 // be on the beefy side.
(...skipping 14 matching lines...) Expand all
45 45
46 GpuVideoDecoder::BufferData::BufferData( 46 GpuVideoDecoder::BufferData::BufferData(
47 int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns) 47 int32 bbid, base::TimeDelta ts, const gfx::Rect& vr, const gfx::Size& ns)
48 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr), 48 : bitstream_buffer_id(bbid), timestamp(ts), visible_rect(vr),
49 natural_size(ns) { 49 natural_size(ns) {
50 } 50 }
51 51
52 GpuVideoDecoder::BufferData::~BufferData() {} 52 GpuVideoDecoder::BufferData::~BufferData() {}
53 53
54 GpuVideoDecoder::GpuVideoDecoder( 54 GpuVideoDecoder::GpuVideoDecoder(
55 const scoped_refptr<GpuVideoAcceleratorFactories>& factories) 55 const scoped_refptr<GpuVideoDecoderFactories>& factories)
56 : needs_bitstream_conversion_(false), 56 : needs_bitstream_conversion_(false),
57 gvd_loop_proxy_(factories->GetMessageLoop()), 57 gvd_loop_proxy_(factories->GetMessageLoop()),
58 weak_factory_(this), 58 weak_factory_(this),
59 factories_(factories), 59 factories_(factories),
60 state_(kNormal), 60 state_(kNormal),
61 decoder_texture_target_(0), 61 decoder_texture_target_(0),
62 next_picture_buffer_id_(0), 62 next_picture_buffer_id_(0),
63 next_bitstream_buffer_id_(0), 63 next_bitstream_buffer_id_(0),
64 available_pictures_(0) { 64 available_pictures_(0) {
65 DCHECK(factories_.get()); 65 DCHECK(factories_.get());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 needs_bitstream_conversion_ = (config.codec() == kCodecH264); 166 needs_bitstream_conversion_ = (config.codec() == kCodecH264);
167 167
168 if (previously_initialized) { 168 if (previously_initialized) {
169 // Reinitialization with a different config (but same codec and profile). 169 // Reinitialization with a different config (but same codec and profile).
170 // VDA should handle it by detecting this in-stream by itself, 170 // VDA should handle it by detecting this in-stream by itself,
171 // no need to notify it. 171 // no need to notify it.
172 status_cb.Run(PIPELINE_OK); 172 status_cb.Run(PIPELINE_OK);
173 return; 173 return;
174 } 174 }
175 175
176 vda_ = 176 vda_.reset(factories_->CreateVideoDecodeAccelerator(config.profile(), this));
177 factories_->CreateVideoDecodeAccelerator(config.profile(), this).Pass();
178 if (!vda_) { 177 if (!vda_) {
179 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); 178 status_cb.Run(DECODER_ERROR_NOT_SUPPORTED);
180 return; 179 return;
181 } 180 }
182 181
183 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded."; 182 DVLOG(3) << "GpuVideoDecoder::Initialize() succeeded.";
184 status_cb.Run(PIPELINE_OK); 183 status_cb.Run(PIPELINE_OK);
185 } 184 }
186 185
187 void GpuVideoDecoder::DestroyTextures() { 186 void GpuVideoDecoder::DestroyTextures() {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 pb.texture_mailbox(), 428 pb.texture_mailbox(),
430 0, // sync_point 429 0, // sync_point
431 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReusePictureBuffer, 430 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReusePictureBuffer,
432 weak_this_, 431 weak_this_,
433 picture.picture_buffer_id()))), 432 picture.picture_buffer_id()))),
434 decoder_texture_target_, 433 decoder_texture_target_,
435 pb.size(), 434 pb.size(),
436 visible_rect, 435 visible_rect,
437 natural_size, 436 natural_size,
438 timestamp, 437 timestamp,
439 base::Bind(&GpuVideoAcceleratorFactories::ReadPixels, 438 base::Bind(&GpuVideoDecoderFactories::ReadPixels,
440 factories_, 439 factories_,
441 pb.texture_id(), 440 pb.texture_id(),
442 decoder_texture_target_, 441 decoder_texture_target_,
443 gfx::Size(visible_rect.width(), visible_rect.height())), 442 gfx::Size(visible_rect.width(), visible_rect.height())),
444 base::Closure())); 443 base::Closure()));
445 CHECK_GT(available_pictures_, 0); 444 CHECK_GT(available_pictures_, 0);
446 --available_pictures_; 445 --available_pictures_;
447 bool inserted = 446 bool inserted =
448 picture_buffers_at_display_.insert(picture.picture_buffer_id()).second; 447 picture_buffers_at_display_.insert(picture.picture_buffer_id()).second;
449 DCHECK(inserted); 448 DCHECK(inserted);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 597
599 state_ = kError; 598 state_ = kError;
600 599
601 if (!pending_decode_cb_.is_null()) { 600 if (!pending_decode_cb_.is_null()) {
602 base::ResetAndReturn(&pending_decode_cb_).Run(kDecodeError, NULL); 601 base::ResetAndReturn(&pending_decode_cb_).Run(kDecodeError, NULL);
603 return; 602 return;
604 } 603 }
605 } 604 }
606 605
607 } // namespace media 606 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/filters/gpu_video_decoder_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698