OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 const EncodedImage& inputImage, bool missingFrames, | 93 const EncodedImage& inputImage, bool missingFrames, |
94 const RTPFragmentationHeader* fragmentation, | 94 const RTPFragmentationHeader* fragmentation, |
95 const CodecSpecificInfo* codecSpecificInfo = NULL, | 95 const CodecSpecificInfo* codecSpecificInfo = NULL, |
96 int64_t renderTimeMs = -1) override; | 96 int64_t renderTimeMs = -1) override; |
97 | 97 |
98 int32_t RegisterDecodeCompleteCallback(DecodedImageCallback* callback) | 98 int32_t RegisterDecodeCompleteCallback(DecodedImageCallback* callback) |
99 override; | 99 override; |
100 | 100 |
101 int32_t Release() override; | 101 int32_t Release() override; |
102 | 102 |
103 int32_t Reset() override; | |
104 | |
105 bool PrefersLateDecoding() const override { return true; } | 103 bool PrefersLateDecoding() const override { return true; } |
106 | 104 |
107 // rtc::MessageHandler implementation. | 105 // rtc::MessageHandler implementation. |
108 void OnMessage(rtc::Message* msg) override; | 106 void OnMessage(rtc::Message* msg) override; |
109 | 107 |
110 const char* ImplementationName() const override; | 108 const char* ImplementationName() const override; |
111 | 109 |
112 private: | 110 private: |
113 // CHECK-fail if not running on |codec_thread_|. | 111 // CHECK-fail if not running on |codec_thread_|. |
114 void CheckOnCodecThread(); | 112 void CheckOnCodecThread(); |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 782 } |
785 return true; | 783 return true; |
786 } | 784 } |
787 | 785 |
788 int32_t MediaCodecVideoDecoder::RegisterDecodeCompleteCallback( | 786 int32_t MediaCodecVideoDecoder::RegisterDecodeCompleteCallback( |
789 DecodedImageCallback* callback) { | 787 DecodedImageCallback* callback) { |
790 callback_ = callback; | 788 callback_ = callback; |
791 return WEBRTC_VIDEO_CODEC_OK; | 789 return WEBRTC_VIDEO_CODEC_OK; |
792 } | 790 } |
793 | 791 |
794 int32_t MediaCodecVideoDecoder::Reset() { | |
795 ALOGD << "DecoderReset"; | |
796 if (!inited_) { | |
797 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | |
798 } | |
799 return InitDecode(&codec_, 1); | |
800 } | |
801 | |
802 void MediaCodecVideoDecoder::OnMessage(rtc::Message* msg) { | 792 void MediaCodecVideoDecoder::OnMessage(rtc::Message* msg) { |
803 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 793 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
804 ScopedLocalRefFrame local_ref_frame(jni); | 794 ScopedLocalRefFrame local_ref_frame(jni); |
805 if (!inited_) { | 795 if (!inited_) { |
806 return; | 796 return; |
807 } | 797 } |
808 // We only ever send one message to |this| directly (not through a Bind()'d | 798 // We only ever send one message to |this| directly (not through a Bind()'d |
809 // functor), so expect no ID/data. | 799 // functor), so expect no ID/data. |
810 RTC_CHECK(!msg->message_id) << "Unexpected message!"; | 800 RTC_CHECK(!msg->message_id) << "Unexpected message!"; |
811 RTC_CHECK(!msg->pdata) << "Unexpected message!"; | 801 RTC_CHECK(!msg->pdata) << "Unexpected message!"; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 ALOGD << "Destroy video decoder."; | 884 ALOGD << "Destroy video decoder."; |
895 delete decoder; | 885 delete decoder; |
896 } | 886 } |
897 | 887 |
898 const char* MediaCodecVideoDecoder::ImplementationName() const { | 888 const char* MediaCodecVideoDecoder::ImplementationName() const { |
899 return "MediaCodec"; | 889 return "MediaCodec"; |
900 } | 890 } |
901 | 891 |
902 } // namespace webrtc_jni | 892 } // namespace webrtc_jni |
903 | 893 |
OLD | NEW |