Chromium Code Reviews

Unified Diff: media/base/android/webaudio_media_codec_bridge.h

Issue 1565623002: Replace WebAudio MediaCodec usage with FFmpeg. A ~4x improvement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete expectations. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « media/base/android/media_jni_registrar.cc ('k') | media/base/android/webaudio_media_codec_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/webaudio_media_codec_bridge.h
diff --git a/media/base/android/webaudio_media_codec_bridge.h b/media/base/android/webaudio_media_codec_bridge.h
deleted file mode 100644
index cd408438e4ddc52b8ea1fa884264b66c071b0661..0000000000000000000000000000000000000000
--- a/media/base/android/webaudio_media_codec_bridge.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_BASE_ANDROID_WEBAUDIO_MEDIA_CODEC_BRIDGE_H_
-#define MEDIA_BASE_ANDROID_WEBAUDIO_MEDIA_CODEC_BRIDGE_H_
-
-#include <jni.h>
-#include <stdint.h>
-
-#include "base/android/scoped_java_ref.h"
-#include "base/callback.h"
-#include "base/file_descriptor_posix.h"
-#include "base/macros.h"
-#include "base/memory/shared_memory.h"
-#include "media/base/media_export.h"
-
-namespace media {
-
-// This class serves as a bridge for native code to call Java
-// functions in the Android MediaCodec class. See
-// http://developer.android.com/reference/android/media/MediaCodec.html.
-class MEDIA_EXPORT WebAudioMediaCodecBridge {
- public:
- // Create the bridge with the given file descriptors. We read from
- // |encoded_audio_handle| to get the encoded audio data. Audio file
- // information and decoded PCM samples are written to |pcm_output|.
- // We also take ownership of |pcm_output|.
- WebAudioMediaCodecBridge(base::SharedMemoryHandle encoded_audio_handle,
- base::FileDescriptor pcm_output,
- uint32_t data_size);
- ~WebAudioMediaCodecBridge();
-
- // Inform JNI about this bridge. Returns true if registration
- // succeeded.
- static bool RegisterWebAudioMediaCodecBridge(JNIEnv* env);
-
- // Start MediaCodec to process the encoded data in
- // |encoded_audio_handle|. The PCM samples are sent to |pcm_output|.
- static void RunWebAudioMediaCodec(
- base::SharedMemoryHandle encoded_audio_handle,
- base::FileDescriptor pcm_output,
- uint32_t data_size,
- base::Closure on_decode_finished_cb);
-
- void OnChunkDecoded(
- JNIEnv* env,
- const base::android::JavaParamRef<jobject>& /*java object*/,
- const base::android::JavaParamRef<jobject>& buf,
- jint buf_size,
- jint input_channel_count,
- jint output_channel_count);
-
- void InitializeDestination(
- JNIEnv* env,
- const base::android::JavaParamRef<jobject>& /*java object*/,
- jint channel_count,
- jint sample_rate,
- jlong duration_us);
-
- private:
- // Handles MediaCodec processing of the encoded data in
- // |encoded_audio_handle_| and sends the pcm data to |pcm_output_|.
- // Returns true if decoding was successful.
- bool DecodeInMemoryAudioFile();
-
- // Save encoded audio data to a temporary file and return the file
- // descriptor to that file. -1 is returned if the audio data could
- // not be saved for any reason.
- int SaveEncodedAudioToFile(JNIEnv*, jobject);
-
- // The encoded audio data is read from this file descriptor for the
- // shared memory that holds the encoded data.
- base::SharedMemoryHandle encoded_audio_handle_;
-
- // The audio file information and decoded pcm data are written to
- // this file descriptor. We take ownership of this descriptor.
- int pcm_output_;
-
- // The length of the encoded data.
- uint32_t data_size_;
-
- DISALLOW_COPY_AND_ASSIGN(WebAudioMediaCodecBridge);
-};
-
-} // namespace media
-#endif // MEDIA_BASE_ANDROID_WEBAUDIO_MEDIA_CODEC_BRIDGE_H_
« no previous file with comments | « media/base/android/media_jni_registrar.cc ('k') | media/base/android/webaudio_media_codec_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine