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

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

Issue 1726103002: Disable adaptive resolution support for MediaCodec use by AVDA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/sdk_media_codec_bridge.h ('k') | no next file » | 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 553 }
554 554
555 // static 555 // static
556 bool VideoCodecBridge::IsKnownUnaccelerated(const VideoCodec& codec, 556 bool VideoCodecBridge::IsKnownUnaccelerated(const VideoCodec& codec,
557 MediaCodecDirection direction) { 557 MediaCodecDirection direction) {
558 return MediaCodecUtil::IsKnownUnaccelerated( 558 return MediaCodecUtil::IsKnownUnaccelerated(
559 VideoCodecToAndroidMimeType(codec), direction); 559 VideoCodecToAndroidMimeType(codec), direction);
560 } 560 }
561 561
562 // static 562 // static
563 VideoCodecBridge* VideoCodecBridge::CreateDecoder(const VideoCodec& codec, 563 VideoCodecBridge* VideoCodecBridge::CreateDecoder(
564 bool is_secure, 564 const VideoCodec& codec,
565 const gfx::Size& size, 565 bool is_secure,
566 jobject surface, 566 const gfx::Size& size,
567 jobject media_crypto) { 567 jobject surface,
568 jobject media_crypto,
569 bool enable_adaptive_playback) {
liberato (no reviews please) 2016/02/23 22:53:42 s/enable/allow/?
DaleCurtis 2016/02/23 23:07:42 Done.
568 if (!MediaCodecUtil::IsMediaCodecAvailable()) 570 if (!MediaCodecUtil::IsMediaCodecAvailable())
569 return nullptr; 571 return nullptr;
570 572
571 const std::string mime = VideoCodecToAndroidMimeType(codec); 573 const std::string mime = VideoCodecToAndroidMimeType(codec);
572 if (mime.empty()) 574 if (mime.empty())
573 return nullptr; 575 return nullptr;
574 576
575 scoped_ptr<VideoCodecBridge> bridge( 577 scoped_ptr<VideoCodecBridge> bridge(
576 new VideoCodecBridge(mime, is_secure, MEDIA_CODEC_DECODER)); 578 new VideoCodecBridge(mime, is_secure, MEDIA_CODEC_DECODER));
577 if (!bridge->media_codec()) 579 if (!bridge->media_codec())
578 return nullptr; 580 return nullptr;
579 581
580 JNIEnv* env = AttachCurrentThread(); 582 JNIEnv* env = AttachCurrentThread();
581 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime); 583 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime);
582 ScopedJavaLocalRef<jobject> j_format( 584 ScopedJavaLocalRef<jobject> j_format(
583 Java_MediaCodecBridge_createVideoDecoderFormat( 585 Java_MediaCodecBridge_createVideoDecoderFormat(
584 env, j_mime.obj(), size.width(), size.height())); 586 env, j_mime.obj(), size.width(), size.height()));
585 DCHECK(!j_format.is_null()); 587 DCHECK(!j_format.is_null());
586 if (!Java_MediaCodecBridge_configureVideo(env, bridge->media_codec(), 588 if (!Java_MediaCodecBridge_configureVideo(
587 j_format.obj(), surface, 589 env, bridge->media_codec(), j_format.obj(), surface, media_crypto, 0,
588 media_crypto, 0)) { 590 enable_adaptive_playback)) {
589 return nullptr; 591 return nullptr;
590 } 592 }
591 593
592 return bridge->Start() ? bridge.release() : nullptr; 594 return bridge->Start() ? bridge.release() : nullptr;
593 } 595 }
594 596
595 // static 597 // static
596 VideoCodecBridge* VideoCodecBridge::CreateEncoder(const VideoCodec& codec, 598 VideoCodecBridge* VideoCodecBridge::CreateEncoder(const VideoCodec& codec,
597 const gfx::Size& size, 599 const gfx::Size& size,
598 int bit_rate, 600 int bit_rate,
(...skipping 14 matching lines...) Expand all
613 615
614 JNIEnv* env = AttachCurrentThread(); 616 JNIEnv* env = AttachCurrentThread();
615 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime); 617 ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime);
616 ScopedJavaLocalRef<jobject> j_format( 618 ScopedJavaLocalRef<jobject> j_format(
617 Java_MediaCodecBridge_createVideoEncoderFormat( 619 Java_MediaCodecBridge_createVideoEncoderFormat(
618 env, j_mime.obj(), size.width(), size.height(), bit_rate, frame_rate, 620 env, j_mime.obj(), size.width(), size.height(), bit_rate, frame_rate,
619 i_frame_interval, color_format)); 621 i_frame_interval, color_format));
620 DCHECK(!j_format.is_null()); 622 DCHECK(!j_format.is_null());
621 if (!Java_MediaCodecBridge_configureVideo(env, bridge->media_codec(), 623 if (!Java_MediaCodecBridge_configureVideo(env, bridge->media_codec(),
622 j_format.obj(), nullptr, nullptr, 624 j_format.obj(), nullptr, nullptr,
623 kConfigureFlagEncode)) { 625 kConfigureFlagEncode, true)) {
624 return nullptr; 626 return nullptr;
625 } 627 }
626 628
627 return bridge->Start() ? bridge.release() : nullptr; 629 return bridge->Start() ? bridge.release() : nullptr;
628 } 630 }
629 631
630 VideoCodecBridge::VideoCodecBridge(const std::string& mime, 632 VideoCodecBridge::VideoCodecBridge(const std::string& mime,
631 bool is_secure, 633 bool is_secure,
632 MediaCodecDirection direction) 634 MediaCodecDirection direction)
633 : SdkMediaCodecBridge(mime, is_secure, direction), 635 : SdkMediaCodecBridge(mime, is_secure, direction),
(...skipping 13 matching lines...) Expand all
647 if (adaptive_playback_supported_for_testing_ == 0) 649 if (adaptive_playback_supported_for_testing_ == 0)
648 return false; 650 return false;
649 else if (adaptive_playback_supported_for_testing_ > 0) 651 else if (adaptive_playback_supported_for_testing_ > 0)
650 return true; 652 return true;
651 JNIEnv* env = AttachCurrentThread(); 653 JNIEnv* env = AttachCurrentThread();
652 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), 654 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(),
653 width, height); 655 width, height);
654 } 656 }
655 657
656 } // namespace media 658 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/sdk_media_codec_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698