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

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

Issue 215783002: Fix an issue that audio and video may run out of sync (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 6 years, 8 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 | Annotate | Revision Log
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_MEDIA_SOURCE_PLAYER_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual void OnDemuxerDataAvailable(const DemuxerData& params) OVERRIDE; 71 virtual void OnDemuxerDataAvailable(const DemuxerData& params) OVERRIDE;
72 virtual void OnDemuxerSeekDone( 72 virtual void OnDemuxerSeekDone(
73 base::TimeDelta actual_browser_seek_time) OVERRIDE; 73 base::TimeDelta actual_browser_seek_time) OVERRIDE;
74 virtual void OnDemuxerDurationChanged(base::TimeDelta duration) OVERRIDE; 74 virtual void OnDemuxerDurationChanged(base::TimeDelta duration) OVERRIDE;
75 75
76 private: 76 private:
77 friend class MediaSourcePlayerTest; 77 friend class MediaSourcePlayerTest;
78 78
79 // Update the current timestamp. 79 // Update the current timestamp.
80 void UpdateTimestamps(base::TimeDelta presentation_timestamp, 80 void UpdateTimestamps(base::TimeDelta presentation_timestamp,
81 size_t audio_output_bytes); 81 size_t audio_output_bytes,
82 int64 audio_head_position,
83 base::TimeTicks audio_render_time);
82 84
83 // Helper function for starting media playback. 85 // Helper function for starting media playback.
84 void StartInternal(); 86 void StartInternal();
85 87
86 // Playback is completed for one channel. 88 // Playback is completed for one channel.
87 void PlaybackCompleted(bool is_audio); 89 void PlaybackCompleted(bool is_audio);
88 90
89 // Called when the decoder finishes its task. 91 // Called when the decoder finishes its task.
90 void MediaDecoderCallback( 92 void MediaDecoderCallback(
91 bool is_audio, MediaCodecStatus status, 93 bool is_audio, MediaCodecStatus status,
92 base::TimeDelta presentation_timestamp, 94 base::TimeDelta presentation_timestamp,
93 size_t audio_output_bytes); 95 size_t audio_output_bytes,
96 int64 audio_head_position,
97 base::TimeTicks audio_render_time);
94 98
95 // Gets MediaCrypto object from |drm_bridge_|. 99 // Gets MediaCrypto object from |drm_bridge_|.
96 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); 100 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto();
97 101
98 // Callback to notify that MediaCrypto is ready in |drm_bridge_|. 102 // Callback to notify that MediaCrypto is ready in |drm_bridge_|.
99 void OnMediaCryptoReady(); 103 void OnMediaCryptoReady();
100 104
101 // Handle pending events if all the decoder jobs are not currently decoding. 105 // Handle pending events if all the decoder jobs are not currently decoding.
102 void ProcessPendingEvents(); 106 void ProcessPendingEvents();
103 107
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Weak pointer passed to media decoder jobs for callbacks. 293 // Weak pointer passed to media decoder jobs for callbacks.
290 // NOTE: Weak pointers must be invalidated before all other member variables. 294 // NOTE: Weak pointers must be invalidated before all other member variables.
291 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; 295 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_;
292 296
293 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); 297 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer);
294 }; 298 };
295 299
296 } // namespace media 300 } // namespace media
297 301
298 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 302 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698