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

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

Issue 2283493003: Delete browser MSE implementation. (Closed)
Patch Set: Actually delete MSP. Cleanse references. Remove AudioTrack usage. Created 4 years, 2 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
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 #ifndef MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ 5 #ifndef MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_
6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ 6 #define MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // MediaCodecBridge. 90 // MediaCodecBridge.
91 class MEDIA_EXPORT AudioCodecBridge : public SdkMediaCodecBridge { 91 class MEDIA_EXPORT AudioCodecBridge : public SdkMediaCodecBridge {
92 public: 92 public:
93 // Returns an AudioCodecBridge instance if |codec| is supported, or a NULL 93 // Returns an AudioCodecBridge instance if |codec| is supported, or a NULL
94 // pointer otherwise. 94 // pointer otherwise.
95 static AudioCodecBridge* Create(const AudioCodec& codec); 95 static AudioCodecBridge* Create(const AudioCodec& codec);
96 96
97 // See MediaCodecUtil::IsKnownUnaccelerated(). 97 // See MediaCodecUtil::IsKnownUnaccelerated().
98 static bool IsKnownUnaccelerated(const AudioCodec& codec); 98 static bool IsKnownUnaccelerated(const AudioCodec& codec);
99 99
100 // Starts the audio codec bridge. If |play_audio| is true this method creates 100 // Starts the audio codec bridge.
101 // Android AudioTrack object for the actual audio playback
102 // (http://developer.android.com/reference/android/media/AudioTrack.html).
103 bool ConfigureAndStart(const AudioDecoderConfig& config, 101 bool ConfigureAndStart(const AudioDecoderConfig& config,
104 bool play_audio,
105 jobject media_crypto); 102 jobject media_crypto);
106 103
107 // An overloaded variant used by AudioDecoderJob and AudioMediaCodecDecoder. 104 // An overloaded variant used by AudioDecoderJob and AudioMediaCodecDecoder.
108 // TODO(timav): Modify the above mentioned classes to pass parameters as 105 // TODO(timav): Modify the above mentioned classes to pass parameters as
109 // AudioDecoderConfig and remove this method. 106 // AudioDecoderConfig and remove this method.
110 bool ConfigureAndStart(const AudioCodec& codec, 107 bool ConfigureAndStart(const AudioCodec& codec,
111 int sample_rate, 108 int sample_rate,
112 int channel_count, 109 int channel_count,
113 const uint8_t* extra_data, 110 const uint8_t* extra_data,
114 size_t extra_data_size, 111 size_t extra_data_size,
115 int64_t codec_delay_ns, 112 int64_t codec_delay_ns,
116 int64_t seek_preroll_ns, 113 int64_t seek_preroll_ns,
117 bool play_audio,
118 jobject media_crypto) WARN_UNUSED_RESULT; 114 jobject media_crypto) WARN_UNUSED_RESULT;
119 115
120 // Creates AudioTrack object for |sampling_rate| and |channel_count|
121 // (http://developer.android.com/reference/android/media/AudioTrack.html).
122 // Returns true in the case of success, false otherwise.
123 bool CreateAudioTrack(int sampling_rate, int channel_count);
124
125 // Plays the output buffer right away or save for later playback if |postpone|
126 // is set to true. This call must be called after DequeueOutputBuffer() and
127 // before ReleaseOutputBuffer. The data is extracted from the output buffers
128 // using |index|, |size| and |offset|. The playback head position in frames is
129 // output in |*playback_pos|.
130 // When |postpone| is set to true, the next PlayOutputBuffer() should have
131 // postpone == false, and it will play two buffers: the postponed one and
132 // the one identified by |index|.
133 // Returns MEDIA_CODEC_ERROR if an error occurs, or MEDIA_CODEC_OK otherwise.
134 MediaCodecStatus PlayOutputBuffer(int index,
135 size_t size,
136 size_t offset,
137 bool postpone,
138 int64_t* playback_pos);
139
140 // Set the volume of the audio output.
141 void SetVolume(double volume);
142
143 private: 116 private:
144 explicit AudioCodecBridge(const std::string& mime); 117 explicit AudioCodecBridge(const std::string& mime);
145 118
146 // Configure the java MediaFormat object with the extra codec data passed in. 119 // Configure the java MediaFormat object with the extra codec data passed in.
147 bool ConfigureMediaFormat(jobject j_format, 120 bool ConfigureMediaFormat(jobject j_format,
148 const AudioCodec& codec, 121 const AudioCodec& codec,
149 const uint8_t* extra_data, 122 const uint8_t* extra_data,
150 size_t extra_data_size, 123 size_t extra_data_size,
151 int64_t codec_delay_ns, 124 int64_t codec_delay_ns,
152 int64_t seek_preroll_ns); 125 int64_t seek_preroll_ns);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 bool is_secure, 176 bool is_secure,
204 MediaCodecDirection direction, 177 MediaCodecDirection direction,
205 bool require_software_codec); 178 bool require_software_codec);
206 179
207 int adaptive_playback_supported_for_testing_; 180 int adaptive_playback_supported_for_testing_;
208 }; 181 };
209 182
210 } // namespace media 183 } // namespace media
211 184
212 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_ 185 #endif // MEDIA_BASE_ANDROID_SDK_MEDIA_CODEC_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698