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

Side by Side Diff: media/base/pipeline.h

Issue 10836167: Move VideoDecoder initialization into VideoRendererBase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PIPELINE_H_ 5 #ifndef MEDIA_BASE_PIPELINE_H_
6 #define MEDIA_BASE_PIPELINE_H_ 6 #define MEDIA_BASE_PIPELINE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 13 matching lines...) Expand all
24 class MessageLoopProxy; 24 class MessageLoopProxy;
25 class TimeDelta; 25 class TimeDelta;
26 } 26 }
27 27
28 namespace media { 28 namespace media {
29 29
30 class AudioDecoder; 30 class AudioDecoder;
31 class Clock; 31 class Clock;
32 class FilterCollection; 32 class FilterCollection;
33 class MediaLog; 33 class MediaLog;
34 class VideoDecoder;
35 class VideoRenderer; 34 class VideoRenderer;
36 35
37 // Adapter for using asynchronous Pipeline methods in code that wants to run 36 // Adapter for using asynchronous Pipeline methods in code that wants to run
38 // synchronously. To use, construct an instance of this class and pass the 37 // synchronously. To use, construct an instance of this class and pass the
39 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for 38 // |Callback()| to the Pipeline method requiring a callback. Then Wait() for
40 // the callback to get fired and call status() to see what the callback's 39 // the callback to get fired and call status() to see what the callback's
41 // argument was. This object is for one-time use; call |Callback()| exactly 40 // argument was. This object is for one-time use; call |Callback()| exactly
42 // once. 41 // once.
43 class MEDIA_EXPORT PipelineStatusNotification { 42 class MEDIA_EXPORT PipelineStatusNotification {
44 public: 43 public:
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Only allow ourselves to be deleted by reference counting. 206 // Only allow ourselves to be deleted by reference counting.
208 friend class base::RefCountedThreadSafe<Pipeline>; 207 friend class base::RefCountedThreadSafe<Pipeline>;
209 virtual ~Pipeline(); 208 virtual ~Pipeline();
210 209
211 // Pipeline states, as described above. 210 // Pipeline states, as described above.
212 enum State { 211 enum State {
213 kCreated, 212 kCreated,
214 kInitDemuxer, 213 kInitDemuxer,
215 kInitAudioDecoder, 214 kInitAudioDecoder,
216 kInitAudioRenderer, 215 kInitAudioRenderer,
217 kInitVideoDecoder,
218 kInitVideoRenderer, 216 kInitVideoRenderer,
219 kPausing, 217 kPausing,
220 kSeeking, 218 kSeeking,
221 kFlushing, 219 kFlushing,
222 kStarting, 220 kStarting,
223 kStarted, 221 kStarted,
224 kStopping, 222 kStopping,
225 kStopped, 223 kStopped,
226 }; 224 };
227 225
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Internal methods used in the implementation of the pipeline thread. All 343 // Internal methods used in the implementation of the pipeline thread. All
346 // of these methods are only called on the pipeline thread. 344 // of these methods are only called on the pipeline thread.
347 345
348 // The following initialize methods are used to select a specific type of 346 // The following initialize methods are used to select a specific type of
349 // object from FilterCollection and initialize it asynchronously. 347 // object from FilterCollection and initialize it asynchronously.
350 void InitializeDemuxer(); 348 void InitializeDemuxer();
351 void OnDemuxerInitialized(PipelineStatus status); 349 void OnDemuxerInitialized(PipelineStatus status);
352 350
353 // Returns true if the asynchronous action of creating decoder has started. 351 // Returns true if the asynchronous action of creating decoder has started.
354 // Returns false if this method did nothing because the corresponding 352 // Returns false if this method did nothing because the corresponding
355 // audio/video stream does not exist. 353 // audio stream does not exist.
356 bool InitializeAudioDecoder(const scoped_refptr<Demuxer>& demuxer); 354 bool InitializeAudioDecoder(const scoped_refptr<Demuxer>& demuxer);
357 bool InitializeVideoDecoder(const scoped_refptr<Demuxer>& demuxer);
358 355
359 // Initializes a renderer and connects it with decoder. Returns true if the 356 // Initializes a renderer and connects it with decoder. Returns true if the
360 // asynchronous action of creating renderer has started. Returns 357 // asynchronous action of creating renderer has started. Returns
361 // false if this method did nothing because the corresponding audio/video 358 // false if this method did nothing because the corresponding audio/video
362 // stream does not exist. 359 // stream does not exist.
363 bool InitializeAudioRenderer(const scoped_refptr<AudioDecoder>& decoder); 360 bool InitializeAudioRenderer(const scoped_refptr<AudioDecoder>& decoder);
364 bool InitializeVideoRenderer(const scoped_refptr<VideoDecoder>& decoder); 361 bool InitializeVideoRenderer(
362 const scoped_refptr<DemuxerStream>& stream);
365 363
366 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask(). 364 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask().
367 // When we start to tear down the pipeline, we will consider two cases: 365 // When we start to tear down the pipeline, we will consider two cases:
368 // 1. when pipeline has not been initialized, we will transit to stopping 366 // 1. when pipeline has not been initialized, we will transit to stopping
369 // state first. 367 // state first.
370 // 2. when pipeline has been initialized, we will first transit to pausing 368 // 2. when pipeline has been initialized, we will first transit to pausing
371 // => flushing => stopping => stopped state. 369 // => flushing => stopping => stopped state.
372 // This will remove the race condition during stop between filters. 370 // This will remove the race condition during stop between filters.
373 void TearDownPipeline(); 371 void TearDownPipeline();
374 372
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 487
490 // Filter collection as passed in by Start(). 488 // Filter collection as passed in by Start().
491 scoped_ptr<FilterCollection> filter_collection_; 489 scoped_ptr<FilterCollection> filter_collection_;
492 490
493 // Callbacks for various pipeline operations. 491 // Callbacks for various pipeline operations.
494 PipelineStatusCB seek_cb_; 492 PipelineStatusCB seek_cb_;
495 base::Closure stop_cb_; 493 base::Closure stop_cb_;
496 PipelineStatusCB ended_cb_; 494 PipelineStatusCB ended_cb_;
497 PipelineStatusCB error_cb_; 495 PipelineStatusCB error_cb_;
498 496
499 // Decoder reference used for signalling imminent shutdown. 497 // Audio renderer reference used for setting the volume and determining
500 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the
501 // renderer thread loop hostage for until PipelineImpl::Stop() calls its
502 // callback.
503 // This reference should only be used for this hack and no other purposes.
504 // http://crbug.com/110228 tracks removing this hack.
505 scoped_refptr<VideoDecoder> video_decoder_;
506
507 // Renderer references used for setting the volume and determining
508 // when playback has finished. 498 // when playback has finished.
509 scoped_refptr<AudioRenderer> audio_renderer_; 499 scoped_refptr<AudioRenderer> audio_renderer_;
500
501 // Video Renderer reference used for determining when playback has finished
scherkus (not reviewing) 2012/08/14 22:00:24 this TODO isn't really applicable in this context
acolwell GONE FROM CHROMIUM 2012/08/15 21:36:57 Ami asked me to keep the comment here http://coder
502 // and for signalling imminent shutdown.
503 // The signalling imminent shutdown is a HACK necessary because
504 // WebMediaPlayerImpl::Destroy() holds the render thread loop hostage
505 // until PipelineImpl::Stop() calls its callback.
506 // http://crbug.com/110228 tracks removing this hack.
510 scoped_refptr<VideoRenderer> video_renderer_; 507 scoped_refptr<VideoRenderer> video_renderer_;
511 508
512 // Demuxer reference used for setting the preload value. 509 // Demuxer reference used for setting the preload value.
513 scoped_refptr<Demuxer> demuxer_; 510 scoped_refptr<Demuxer> demuxer_;
514 511
515 // Helper class that stores filter references during pipeline 512 // Helper class that stores filter references during pipeline
516 // initialization. 513 // initialization.
517 struct PipelineInitState; 514 struct PipelineInitState;
518 scoped_ptr<PipelineInitState> pipeline_init_state_; 515 scoped_ptr<PipelineInitState> pipeline_init_state_;
519 516
520 // Statistics. 517 // Statistics.
521 PipelineStatistics statistics_; 518 PipelineStatistics statistics_;
522 // Time of pipeline creation; is non-zero only until the pipeline first 519 // Time of pipeline creation; is non-zero only until the pipeline first
523 // reaches "kStarted", at which point it is used & zeroed out. 520 // reaches "kStarted", at which point it is used & zeroed out.
524 base::Time creation_time_; 521 base::Time creation_time_;
525 522
526 scoped_ptr<SerialRunner> pending_callbacks_; 523 scoped_ptr<SerialRunner> pending_callbacks_;
527 524
528 DISALLOW_COPY_AND_ASSIGN(Pipeline); 525 DISALLOW_COPY_AND_ASSIGN(Pipeline);
529 }; 526 };
530 527
531 } // namespace media 528 } // namespace media
532 529
533 #endif // MEDIA_BASE_PIPELINE_H_ 530 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW
« no previous file with comments | « media/base/mock_filters.cc ('k') | media/base/pipeline.cc » ('j') | media/base/video_renderer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698