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

Side by Side Diff: media/base/android/media_decoder_job.cc

Issue 1472943002: Refactor MediaCodecBridge to add support for NDK APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crazy linker issue Created 5 years 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 "media/base/android/media_decoder_job.h" 5 #include "media/base/android/media_decoder_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return MEDIA_CODEC_INPUT_END_OF_STREAM; 275 return MEDIA_CODEC_INPUT_END_OF_STREAM;
276 } 276 }
277 277
278 if (unit.key_id.empty() || unit.iv.empty()) { 278 if (unit.key_id.empty() || unit.iv.empty()) {
279 DCHECK(unit.iv.empty() || !unit.key_id.empty()); 279 DCHECK(unit.iv.empty() || !unit.key_id.empty());
280 return media_codec_bridge_->QueueInputBuffer( 280 return media_codec_bridge_->QueueInputBuffer(
281 input_buf_index, &unit.data[0], unit.data.size(), unit.timestamp); 281 input_buf_index, &unit.data[0], unit.data.size(), unit.timestamp);
282 } 282 }
283 283
284 MediaCodecStatus status = media_codec_bridge_->QueueSecureInputBuffer( 284 MediaCodecStatus status = media_codec_bridge_->QueueSecureInputBuffer(
285 input_buf_index, 285 input_buf_index, &unit.data[0], unit.data.size(), unit.key_id, unit.iv,
286 &unit.data[0], unit.data.size(),
287 reinterpret_cast<const uint8*>(&unit.key_id[0]), unit.key_id.size(),
288 reinterpret_cast<const uint8*>(&unit.iv[0]), unit.iv.size(),
289 unit.subsamples.empty() ? NULL : &unit.subsamples[0], 286 unit.subsamples.empty() ? NULL : &unit.subsamples[0],
290 unit.subsamples.size(), 287 unit.subsamples.size(), unit.timestamp);
291 unit.timestamp);
292 288
293 // In case of MEDIA_CODEC_NO_KEY, we must reuse the |input_buf_index_|. 289 // In case of MEDIA_CODEC_NO_KEY, we must reuse the |input_buf_index_|.
294 // Otherwise MediaDrm will report errors. 290 // Otherwise MediaDrm will report errors.
295 if (status == MEDIA_CODEC_NO_KEY) 291 if (status == MEDIA_CODEC_NO_KEY)
296 input_buf_index_ = input_buf_index; 292 input_buf_index_ = input_buf_index;
297 293
298 return status; 294 return status;
299 } 295 }
300 296
301 bool MediaDecoderJob::HasData() const { 297 bool MediaDecoderJob::HasData() const {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 683
688 void MediaDecoderJob::ReleaseMediaCodecBridge() { 684 void MediaDecoderJob::ReleaseMediaCodecBridge() {
689 if (!media_codec_bridge_) 685 if (!media_codec_bridge_)
690 return; 686 return;
691 687
692 media_codec_bridge_.reset(); 688 media_codec_bridge_.reset();
693 input_buf_index_ = -1; 689 input_buf_index_ = -1;
694 } 690 }
695 691
696 } // namespace media 692 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_codec_video_decoder.cc ('k') | media/base/android/media_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698