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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 1422643002: Pass DecryptConfig parameters over IPC and use it in AVDA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed MediaCodec.CodecException that was added only at level 21 (Android L) Created 5 years, 1 month 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 | « media/base/decrypt_config.cc ('k') | media/media.gyp » ('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"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 assigned_picture_buffers_.erase(it->first); 204 assigned_picture_buffers_.erase(it->first);
205 } 205 }
206 DestroyPictureBuffers(&assigned_picture_buffers_); 206 DestroyPictureBuffers(&assigned_picture_buffers_);
207 } 207 }
208 208
209 void GpuVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, 209 void GpuVideoDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
210 const DecodeCB& decode_cb) { 210 const DecodeCB& decode_cb) {
211 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 211 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
212 DCHECK(pending_reset_cb_.is_null()); 212 DCHECK(pending_reset_cb_.is_null());
213 213
214 DVLOG(3) << __FUNCTION__ << " " << buffer->AsHumanReadableString();
215
214 DecodeCB bound_decode_cb = BindToCurrentLoop(decode_cb); 216 DecodeCB bound_decode_cb = BindToCurrentLoop(decode_cb);
215 217
216 if (state_ == kError || !vda_) { 218 if (state_ == kError || !vda_) {
217 bound_decode_cb.Run(kDecodeError); 219 bound_decode_cb.Run(kDecodeError);
218 return; 220 return;
219 } 221 }
220 222
221 switch (state_) { 223 switch (state_) {
222 case kDecoderDrained: 224 case kDecoderDrained:
223 state_ = kNormal; 225 state_ = kNormal;
(...skipping 21 matching lines...) Expand all
245 bound_decode_cb.Run(kDecodeError); 247 bound_decode_cb.Run(kDecodeError);
246 return; 248 return;
247 } 249 }
248 250
249 memcpy(shm_buffer->shm->memory(), buffer->data(), size); 251 memcpy(shm_buffer->shm->memory(), buffer->data(), size);
250 // AndroidVideoDecodeAccelerator needs the timestamp to output frames in 252 // AndroidVideoDecodeAccelerator needs the timestamp to output frames in
251 // presentation order. 253 // presentation order.
252 BitstreamBuffer bitstream_buffer(next_bitstream_buffer_id_, 254 BitstreamBuffer bitstream_buffer(next_bitstream_buffer_id_,
253 shm_buffer->shm->handle(), size, 255 shm_buffer->shm->handle(), size,
254 buffer->timestamp()); 256 buffer->timestamp());
257
258 if (buffer->decrypt_config())
259 bitstream_buffer.SetDecryptConfig(*buffer->decrypt_config());
260
255 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. 261 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
256 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; 262 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF;
257 DCHECK(!ContainsKey(bitstream_buffers_in_decoder_, bitstream_buffer.id())); 263 DCHECK(!ContainsKey(bitstream_buffers_in_decoder_, bitstream_buffer.id()));
258 bitstream_buffers_in_decoder_.insert(std::make_pair( 264 bitstream_buffers_in_decoder_.insert(std::make_pair(
259 bitstream_buffer.id(), 265 bitstream_buffer.id(),
260 PendingDecoderBuffer(shm_buffer.release(), buffer, decode_cb))); 266 PendingDecoderBuffer(shm_buffer.release(), buffer, decode_cb)));
261 DCHECK_LE(static_cast<int>(bitstream_buffers_in_decoder_.size()), 267 DCHECK_LE(static_cast<int>(bitstream_buffers_in_decoder_.size()),
262 kMaxInFlightDecodes); 268 kMaxInFlightDecodes);
263 RecordBufferData(bitstream_buffer, *buffer.get()); 269 RecordBufferData(bitstream_buffer, *buffer.get());
264 270
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 606 }
601 return false; 607 return false;
602 } 608 }
603 609
604 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 610 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
605 const { 611 const {
606 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 612 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
607 } 613 }
608 614
609 } // namespace media 615 } // namespace media
OLDNEW
« no previous file with comments | « media/base/decrypt_config.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698