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

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

Issue 1992913002: [merged] Report media error if PlayOutputBuffer failed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « media/base/android/media_decoder_job.cc ('k') | media/base/android/video_decoder_job.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/sdk_media_codec_bridge.h" 5 #include "media/base/android/sdk_media_codec_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 size_t offset, 571 size_t offset,
572 bool postpone, 572 bool postpone,
573 int64_t* playback_pos) { 573 int64_t* playback_pos) {
574 DCHECK_LE(0, index); 574 DCHECK_LE(0, index);
575 int numBytes = base::checked_cast<int>(size); 575 int numBytes = base::checked_cast<int>(size);
576 576
577 const uint8_t* buffer = nullptr; 577 const uint8_t* buffer = nullptr;
578 size_t capacity = 0; 578 size_t capacity = 0;
579 MediaCodecStatus status = 579 MediaCodecStatus status =
580 GetOutputBufferAddress(index, offset, &buffer, &capacity); 580 GetOutputBufferAddress(index, offset, &buffer, &capacity);
581 if (status == MEDIA_CODEC_ERROR) 581 if (status != MEDIA_CODEC_OK) {
582 DLOG(ERROR) << __FUNCTION__
583 << ": GetOutputBufferAddress() failed for index:" << index;
582 return status; 584 return status;
585 }
583 586
584 numBytes = std::min(base::checked_cast<int>(capacity), numBytes); 587 numBytes = std::min(base::checked_cast<int>(capacity), numBytes);
585 CHECK_GE(numBytes, 0); 588 CHECK_GE(numBytes, 0);
586 589
587 JNIEnv* env = AttachCurrentThread(); 590 JNIEnv* env = AttachCurrentThread();
588 ScopedJavaLocalRef<jbyteArray> byte_array = 591 ScopedJavaLocalRef<jbyteArray> byte_array =
589 base::android::ToJavaByteArray(env, buffer, numBytes); 592 base::android::ToJavaByteArray(env, buffer, numBytes);
590 *playback_pos = Java_MediaCodecBridge_playOutputBuffer( 593 *playback_pos = Java_MediaCodecBridge_playOutputBuffer(
591 env, media_codec(), byte_array.obj(), postpone); 594 env, media_codec(), byte_array.obj(), postpone);
592 return status; 595 return status;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 if (adaptive_playback_supported_for_testing_ == 0) 697 if (adaptive_playback_supported_for_testing_ == 0)
695 return false; 698 return false;
696 else if (adaptive_playback_supported_for_testing_ > 0) 699 else if (adaptive_playback_supported_for_testing_ > 0)
697 return true; 700 return true;
698 JNIEnv* env = AttachCurrentThread(); 701 JNIEnv* env = AttachCurrentThread();
699 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), 702 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(),
700 width, height); 703 width, height);
701 } 704 }
702 705
703 } // namespace media 706 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_decoder_job.cc ('k') | media/base/android/video_decoder_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698