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

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

Issue 15499006: Enable seek in fullscreen mode for MSE impl on android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 7 years, 7 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 virtual void SetVolume(float leftVolume, float rightVolume) OVERRIDE; 124 virtual void SetVolume(float leftVolume, float rightVolume) OVERRIDE;
125 virtual int GetVideoWidth() OVERRIDE; 125 virtual int GetVideoWidth() OVERRIDE;
126 virtual int GetVideoHeight() OVERRIDE; 126 virtual int GetVideoHeight() OVERRIDE;
127 virtual base::TimeDelta GetCurrentTime() OVERRIDE; 127 virtual base::TimeDelta GetCurrentTime() OVERRIDE;
128 virtual base::TimeDelta GetDuration() OVERRIDE; 128 virtual base::TimeDelta GetDuration() OVERRIDE;
129 virtual bool IsPlaying() OVERRIDE; 129 virtual bool IsPlaying() OVERRIDE;
130 virtual bool CanPause() OVERRIDE; 130 virtual bool CanPause() OVERRIDE;
131 virtual bool CanSeekForward() OVERRIDE; 131 virtual bool CanSeekForward() OVERRIDE;
132 virtual bool CanSeekBackward() OVERRIDE; 132 virtual bool CanSeekBackward() OVERRIDE;
133 virtual bool IsPlayerReady() OVERRIDE; 133 virtual bool IsPlayerReady() OVERRIDE;
134 virtual void OnSeekRequestAck() OVERRIDE;
134 135
135 // Called when the demuxer is ready. 136 // Called when the demuxer is ready.
136 virtual void DemuxerReady( 137 virtual void DemuxerReady(
137 const MediaPlayerHostMsg_DemuxerReady_Params& params) OVERRIDE; 138 const MediaPlayerHostMsg_DemuxerReady_Params& params) OVERRIDE;
138 139
139 // Called when the requested data is received from the demuxer. 140 // Called when the requested data is received from the demuxer.
140 virtual void ReadFromDemuxerAck( 141 virtual void ReadFromDemuxerAck(
141 const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) OVERRIDE; 142 const MediaPlayerHostMsg_ReadFromDemuxerAck_Params& params) OVERRIDE;
142 143
143 private: 144 private:
144 // Update the timestamps for A/V sync scheduling. |kickoff_time| keeps 145 // Update the timestamps for A/V sync scheduling.
145 // track of when the job is started. We need this to check if a seek is
146 // performed during decoding.
147 void UpdateTimestamps( 146 void UpdateTimestamps(
148 const base::Time& kickoff_time,
149 const base::TimeDelta& presentation_timestamp, 147 const base::TimeDelta& presentation_timestamp,
150 const base::Time& wallclock_time); 148 const base::Time& wallclock_time);
151 149
152 // Helper function for starting media playback. 150 // Helper function for starting media playback.
153 void StartInternal(); 151 void StartInternal();
154 152
155 // Playback is completed for one channel. 153 // Playback is completed for one channel.
156 void PlaybackCompleted(bool is_audio); 154 void PlaybackCompleted(bool is_audio);
157 155
158 // Called when the decoder finishes its task. 156 // Called when the decoder finishes its task.
159 void MediaDecoderCallback( 157 void MediaDecoderCallback(
160 bool is_audio, const base::Time& kickoff_time, 158 bool is_audio, const base::TimeDelta& presentation_timestamp,
161 const base::TimeDelta& presentation_timestamp,
162 const base::Time& wallclock_time, bool end_of_stream); 159 const base::Time& wallclock_time, bool end_of_stream);
163 160
164 // Called to decoder more data. 161 // Called to decoder more data.
165 void DecodeMoreAudio(); 162 void DecodeMoreAudio();
166 void DecodeMoreVideo(); 163 void DecodeMoreVideo();
167 164
168 // Functions check whether audio/video is present. 165 // Functions check whether audio/video is present.
169 bool HasVideo(); 166 bool HasVideo();
170 bool HasAudio(); 167 bool HasAudio();
171 168
172 // Pending play event while player is preparing. 169 // Pending play event while player is preparing.
173 bool pending_play_; 170 bool pending_play_;
174 171
172 // Whether there is a pending seek request to send to the renderer.
173 bool pending_media_seek_request_;
174
175 // Number of active decoding tasks.
176 int active_decoding_tasks_;
177
175 // Stats about the media. 178 // Stats about the media.
176 base::TimeDelta duration_; 179 base::TimeDelta duration_;
177 int width_; 180 int width_;
178 int height_; 181 int height_;
179 AudioCodec audio_codec_; 182 AudioCodec audio_codec_;
180 VideoCodec video_codec_; 183 VideoCodec video_codec_;
181 int num_channels_; 184 int num_channels_;
182 int sampling_rate_; 185 int sampling_rate_;
183 bool seekable_; 186 bool seekable_;
184 base::TimeDelta last_presentation_timestamp_; 187 base::TimeDelta last_presentation_timestamp_;
185 std::vector<uint8> audio_extra_data_; 188 std::vector<uint8> audio_extra_data_;
186 bool audio_finished_; 189 bool audio_finished_;
187 bool video_finished_; 190 bool video_finished_;
188 bool playing_; 191 bool playing_;
189 192
190 // Timestamps for providing simple A/V sync. When start decoding an audio 193 // Timestamps for providing simple A/V sync. When start decoding an audio
191 // chunk, we record its presentation timestamp and the current system time. 194 // chunk, we record its presentation timestamp and the current system time.
192 // Then we use this information to estimate when the next audio/video frame 195 // Then we use this information to estimate when the next audio/video frame
193 // should be rendered. 196 // should be rendered.
194 // TODO(qinmin): Need to fix the problem if audio/video lagged too far behind 197 // TODO(qinmin): Need to fix the problem if audio/video lagged too far behind
195 // due to network or decoding problem. 198 // due to network or decoding problem.
196 base::Time start_wallclock_time_; 199 base::Time start_wallclock_time_;
197 base::TimeDelta start_presentation_timestamp_; 200 base::TimeDelta start_presentation_timestamp_;
198 base::Time last_seek_time_;
199 201
200 // Decoder jobs 202 // Decoder jobs
201 ScopedMediaDecoderJob audio_decoder_job_; 203 ScopedMediaDecoderJob audio_decoder_job_;
202 ScopedMediaDecoderJob video_decoder_job_; 204 ScopedMediaDecoderJob video_decoder_job_;
203 205
204 // These variables keep track of the current decoding data. 206 // These variables keep track of the current decoding data.
205 // TODO(qinmin): remove these variables when we no longer relies on IPC for 207 // TODO(qinmin): remove these variables when we no longer relies on IPC for
206 // data passing. 208 // data passing.
207 size_t audio_access_unit_index_; 209 size_t audio_access_unit_index_;
208 size_t video_access_unit_index_; 210 size_t video_access_unit_index_;
209 bool waiting_for_audio_data_; 211 bool waiting_for_audio_data_;
210 bool waiting_for_video_data_; 212 bool waiting_for_video_data_;
211 MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_audio_; 213 MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_audio_;
212 MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_video_; 214 MediaPlayerHostMsg_ReadFromDemuxerAck_Params received_video_;
213 215
214 // Weak pointer passed to media decoder jobs for callbacks. 216 // Weak pointer passed to media decoder jobs for callbacks.
215 base::WeakPtrFactory<MediaSourcePlayer> weak_this_; 217 base::WeakPtrFactory<MediaSourcePlayer> weak_this_;
216 218
217 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); 219 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer);
218 }; 220 };
219 221
220 } // namespace media 222 } // namespace media
221 223
222 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ 224 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698