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

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

Issue 1254293003: MediaCodecPlayer implementation (stage 4 - preroll) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-browserseek
Patch Set: Save the first post-preroll audio buffer and replay it when preroll is done Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_codec_audio_decoder.h
diff --git a/media/base/android/media_codec_audio_decoder.h b/media/base/android/media_codec_audio_decoder.h
index 53bb664f6018b833e4fa5f571c12051c8ad727c9..da068ce05293a357ab4847b7b94dc72244f14b2d 100644
--- a/media/base/android/media_codec_audio_decoder.h
+++ b/media/base/android/media_codec_audio_decoder.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_
#define MEDIA_BASE_ANDROID_MEDIA_CODEC_AUDIO_DECODER_H_
+#include <vector>
#include "media/base/android/media_codec_decoder.h"
namespace media {
@@ -21,6 +22,7 @@ class MediaCodecAudioDecoder : public MediaCodecDecoder {
const scoped_refptr<base::SingleThreadTaskRunner>& media_runner,
const base::Closure& request_data_cb,
const base::Closure& starvation_cb,
+ const base::Closure& preroll_done_cb,
const base::Closure& stop_done_cb,
const base::Closure& error_cb,
const SetTimeCallback& update_current_time_cb);
@@ -31,6 +33,7 @@ class MediaCodecAudioDecoder : public MediaCodecDecoder {
bool HasStream() const override;
void SetDemuxerConfigs(const DemuxerConfigs& configs) override;
void Flush() override;
+ void ReleaseMediaCodec() override;
// Sets the volume of the audio output.
void SetVolume(double volume);
@@ -45,11 +48,22 @@ class MediaCodecAudioDecoder : public MediaCodecDecoder {
void OnOutputFormatChanged() override;
void Render(int buffer_index,
size_t size,
- bool render_output,
+ RenderMode render_mode,
base::TimeDelta pts,
bool eos_encountered) override;
private:
+ struct PendingBuffer {
+ std::vector<uint8> data;
+ base::TimeDelta pts;
+ bool IsValid() const { return !data.empty(); }
+ void Invalidate() { data.clear(); }
+ };
+
+ void CreatePendingBuffer(int buffer_index, size_t size, base::TimeDelta pts);
+
+ void PlayOutputBuffer(int buffer_index, size_t size, base::TimeDelta pts);
+
// A helper method to set the volume.
void SetVolumeInternal();
@@ -80,6 +94,10 @@ class MediaCodecAudioDecoder : public MediaCodecDecoder {
// Object to calculate the current audio timestamp for A/V sync.
scoped_ptr<AudioTimestampHelper> audio_timestamp_helper_;
+ // Output buffer that we want to play at a later time, normally after video
+ // preroll.
+ PendingBuffer pending_buffer_;
+
// Reports current playback time to the callee.
SetTimeCallback update_current_time_cb_;
« no previous file with comments | « no previous file | media/base/android/media_codec_audio_decoder.cc » ('j') | media/base/android/media_codec_audio_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698