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

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

Issue 1287423004: MediaCodecPlayer implementation (stage 5 - reconfiguration) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mtplayer-cleanuptest
Patch Set: Fixed AdvanceAccessUnitQueue() Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CODEC_PLAYER_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_
7 7
8 #include "base/android/scoped_java_ref.h" 8 #include "base/android/scoped_java_ref.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 typedef base::Callback<void(const base::TimeDelta& current_timestamp)> 155 typedef base::Callback<void(const base::TimeDelta& current_timestamp)>
156 SeekDoneCallback; 156 SeekDoneCallback;
157 157
158 typedef base::Callback<void(int)> ErrorCallback; 158 typedef base::Callback<void(int)> ErrorCallback;
159 159
160 // For testing only. 160 // For testing only.
161 typedef base::Callback<void(DemuxerStream::Type, 161 typedef base::Callback<void(DemuxerStream::Type,
162 base::TimeDelta, 162 base::TimeDelta,
163 base::TimeDelta)> DecodersTimeCallback; 163 base::TimeDelta)> DecodersTimeCallback;
164 164
165 // For testing only.
166 typedef base::Callback<void(DemuxerStream::Type)> CodecCreatedCallback;
167
165 // Constructs a player with the given ID and demuxer. |manager| must outlive 168 // Constructs a player with the given ID and demuxer. |manager| must outlive
166 // the lifetime of this object. 169 // the lifetime of this object.
167 MediaCodecPlayer(int player_id, 170 MediaCodecPlayer(int player_id,
168 base::WeakPtr<MediaPlayerManager> manager, 171 base::WeakPtr<MediaPlayerManager> manager,
169 const RequestMediaResourcesCB& request_media_resources_cb, 172 const RequestMediaResourcesCB& request_media_resources_cb,
170 scoped_ptr<DemuxerAndroid> demuxer, 173 scoped_ptr<DemuxerAndroid> demuxer,
171 const GURL& frame_url); 174 const GURL& frame_url);
172 ~MediaCodecPlayer() override; 175 ~MediaCodecPlayer() override;
173 176
174 // A helper method that performs the media thread part of initialization. 177 // A helper method that performs the media thread part of initialization.
(...skipping 19 matching lines...) Expand all
194 void SetCdm(BrowserCdm* cdm) override; 197 void SetCdm(BrowserCdm* cdm) override;
195 198
196 // DemuxerAndroidClient implementation. 199 // DemuxerAndroidClient implementation.
197 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override; 200 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override;
198 void OnDemuxerDataAvailable(const DemuxerData& params) override; 201 void OnDemuxerDataAvailable(const DemuxerData& params) override;
199 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override; 202 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override;
200 void OnDemuxerDurationChanged(base::TimeDelta duration) override; 203 void OnDemuxerDurationChanged(base::TimeDelta duration) override;
201 204
202 // For testing only. 205 // For testing only.
203 void SetDecodersTimeCallbackForTests(DecodersTimeCallback cb); 206 void SetDecodersTimeCallbackForTests(DecodersTimeCallback cb);
207 void SetCodecCreatedCallbackForTests(CodecCreatedCallback cb);
208 void SetAlwaysReconfigureForTests(DemuxerStream::Type type);
204 bool IsPrerollingForTests(DemuxerStream::Type type) const; 209 bool IsPrerollingForTests(DemuxerStream::Type type) const;
205 210
206 private: 211 private:
207 // The state machine states. 212 // The state machine states.
208 enum PlayerState { 213 enum PlayerState {
209 kStatePaused, 214 kStatePaused,
210 kStateWaitingForConfig, 215 kStateWaitingForConfig,
211 kStatePrefetching, 216 kStatePrefetching,
212 kStatePlaying, 217 kStatePlaying,
213 kStateStopping, 218 kStateStopping,
(...skipping 28 matching lines...) Expand all
242 const gfx::Size& video_size) override; 247 const gfx::Size& video_size) override;
243 248
244 // This method caches the current time and calls manager's OnTimeUpdate(). 249 // This method caches the current time and calls manager's OnTimeUpdate().
245 void OnTimeUpdate(base::TimeDelta current_timestamp, 250 void OnTimeUpdate(base::TimeDelta current_timestamp,
246 base::TimeTicks current_time_ticks) override; 251 base::TimeTicks current_time_ticks) override;
247 252
248 // Callbacks from decoders 253 // Callbacks from decoders
249 void RequestDemuxerData(DemuxerStream::Type stream_type); 254 void RequestDemuxerData(DemuxerStream::Type stream_type);
250 void OnPrefetchDone(); 255 void OnPrefetchDone();
251 void OnPrerollDone(); 256 void OnPrerollDone();
252 void OnStopDone(); 257 void OnDecoderDrained(DemuxerStream::Type type);
258 void OnStopDone(DemuxerStream::Type type);
253 void OnError(); 259 void OnError();
254 void OnStarvation(DemuxerStream::Type stream_type); 260 void OnStarvation(DemuxerStream::Type stream_type);
255 void OnTimeIntervalUpdate(DemuxerStream::Type stream_type, 261 void OnTimeIntervalUpdate(DemuxerStream::Type stream_type,
256 base::TimeDelta now_playing, 262 base::TimeDelta now_playing,
257 base::TimeDelta last_buffered, 263 base::TimeDelta last_buffered,
258 bool postpone); 264 bool postpone);
259 265
260 // Callbacks from video decoder 266 // Callbacks from video decoder
261 void OnVideoCodecCreated(); 267 void OnVideoCodecCreated();
262 void OnVideoResolutionChanged(const gfx::Size& size); 268 void OnVideoResolutionChanged(const gfx::Size& size);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 base::WeakPtr<MediaCodecPlayer> media_weak_this_; 358 base::WeakPtr<MediaCodecPlayer> media_weak_this_;
353 // NOTE: Weak pointers must be invalidated before all other member variables. 359 // NOTE: Weak pointers must be invalidated before all other member variables.
354 base::WeakPtrFactory<MediaCodecPlayer> media_weak_factory_; 360 base::WeakPtrFactory<MediaCodecPlayer> media_weak_factory_;
355 361
356 DISALLOW_COPY_AND_ASSIGN(MediaCodecPlayer); 362 DISALLOW_COPY_AND_ASSIGN(MediaCodecPlayer);
357 }; 363 };
358 364
359 } // namespace media 365 } // namespace media
360 366
361 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_ 367 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_PLAYER_H_
OLDNEW
« no previous file with comments | « media/base/android/media_codec_decoder_unittest.cc ('k') | media/base/android/media_codec_player.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698