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

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: 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // Only allow ourselves to be deleted by reference counting. 231 // Only allow ourselves to be deleted by reference counting.
233 friend class base::RefCountedThreadSafe<Pipeline>; 232 friend class base::RefCountedThreadSafe<Pipeline>;
234 virtual ~Pipeline(); 233 virtual ~Pipeline();
235 234
236 // Pipeline states, as described above. 235 // Pipeline states, as described above.
237 enum State { 236 enum State {
238 kCreated, 237 kCreated,
239 kInitDemuxer, 238 kInitDemuxer,
240 kInitAudioDecoder, 239 kInitAudioDecoder,
241 kInitAudioRenderer, 240 kInitAudioRenderer,
242 kInitVideoDecoder,
243 kInitVideoRenderer, 241 kInitVideoRenderer,
244 kPausing, 242 kPausing,
245 kSeeking, 243 kSeeking,
246 kFlushing, 244 kFlushing,
247 kStarting, 245 kStarting,
248 kStarted, 246 kStarted,
249 kEnded, 247 kEnded,
250 kStopping, 248 kStopping,
251 kStopped, 249 kStopped,
252 kError, 250 kError,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Internal methods used in the implementation of the pipeline thread. All 376 // Internal methods used in the implementation of the pipeline thread. All
379 // of these methods are only called on the pipeline thread. 377 // of these methods are only called on the pipeline thread.
380 378
381 // The following initialize methods are used to select a specific type of 379 // The following initialize methods are used to select a specific type of
382 // object from FilterCollection and initialize it asynchronously. 380 // object from FilterCollection and initialize it asynchronously.
383 void InitializeDemuxer(); 381 void InitializeDemuxer();
384 void OnDemuxerInitialized(PipelineStatus status); 382 void OnDemuxerInitialized(PipelineStatus status);
385 383
386 // Returns true if the asynchronous action of creating decoder has started. 384 // Returns true if the asynchronous action of creating decoder has started.
387 // Returns false if this method did nothing because the corresponding 385 // Returns false if this method did nothing because the corresponding
388 // audio/video stream does not exist. 386 // audio/video stream does not exist.
Ami GONE FROM CHROMIUM 2012/08/09 20:30:18 drop "video"
acolwell GONE FROM CHROMIUM 2012/08/09 22:23:32 Done.
389 bool InitializeAudioDecoder(const scoped_refptr<Demuxer>& demuxer); 387 bool InitializeAudioDecoder(const scoped_refptr<Demuxer>& demuxer);
390 bool InitializeVideoDecoder(const scoped_refptr<Demuxer>& demuxer);
391 388
392 // Initializes a renderer and connects it with decoder. Returns true if the 389 // Initializes a renderer and connects it with decoder. Returns true if the
393 // asynchronous action of creating renderer has started. Returns 390 // asynchronous action of creating renderer has started. Returns
394 // false if this method did nothing because the corresponding audio/video 391 // false if this method did nothing because the corresponding audio/video
395 // stream does not exist. 392 // stream does not exist.
396 bool InitializeAudioRenderer(const scoped_refptr<AudioDecoder>& decoder); 393 bool InitializeAudioRenderer(const scoped_refptr<AudioDecoder>& decoder);
397 bool InitializeVideoRenderer(const scoped_refptr<VideoDecoder>& decoder); 394 bool InitializeVideoRenderer(
395 const scoped_refptr<DemuxerStream>& stream);
398 396
399 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask(). 397 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask().
400 // When we start to tear down the pipeline, we will consider two cases: 398 // When we start to tear down the pipeline, we will consider two cases:
401 // 1. when pipeline has not been initialized, we will transit to stopping 399 // 1. when pipeline has not been initialized, we will transit to stopping
402 // state first. 400 // state first.
403 // 2. when pipeline has been initialized, we will first transit to pausing 401 // 2. when pipeline has been initialized, we will first transit to pausing
404 // => flushing => stopping => stopped state. 402 // => flushing => stopping => stopped state.
405 // This will remove the race condition during stop between filters. 403 // This will remove the race condition during stop between filters.
406 void TearDownPipeline(); 404 void TearDownPipeline();
407 405
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 522
525 // Filter collection as passed in by Start(). 523 // Filter collection as passed in by Start().
526 scoped_ptr<FilterCollection> filter_collection_; 524 scoped_ptr<FilterCollection> filter_collection_;
527 525
528 // Callbacks for various pipeline operations. 526 // Callbacks for various pipeline operations.
529 PipelineStatusCB seek_cb_; 527 PipelineStatusCB seek_cb_;
530 base::Closure stop_cb_; 528 base::Closure stop_cb_;
531 PipelineStatusCB ended_cb_; 529 PipelineStatusCB ended_cb_;
532 PipelineStatusCB error_cb_; 530 PipelineStatusCB error_cb_;
533 531
534 // Decoder reference used for signalling imminent shutdown.
535 // This is a HACK necessary because WebMediaPlayerImpl::Destroy() holds the
536 // renderer thread loop hostage for until PipelineImpl::Stop() calls its
537 // callback.
538 // This reference should only be used for this hack and no other purposes.
539 // http://crbug.com/110228 tracks removing this hack.
540 scoped_refptr<VideoDecoder> video_decoder_;
541
542 // Renderer references used for setting the volume and determining 532 // Renderer references used for setting the volume and determining
Ami GONE FROM CHROMIUM 2012/08/09 20:30:18 This comment is lying by omission; I think you wan
acolwell GONE FROM CHROMIUM 2012/08/09 22:23:32 Done.
543 // when playback has finished. 533 // when playback has finished.
544 scoped_refptr<AudioRenderer> audio_renderer_; 534 scoped_refptr<AudioRenderer> audio_renderer_;
545 scoped_refptr<VideoRenderer> video_renderer_; 535 scoped_refptr<VideoRenderer> video_renderer_;
546 536
547 // Demuxer reference used for setting the preload value. 537 // Demuxer reference used for setting the preload value.
548 scoped_refptr<Demuxer> demuxer_; 538 scoped_refptr<Demuxer> demuxer_;
549 539
550 // Helper class that stores filter references during pipeline 540 // Helper class that stores filter references during pipeline
551 // initialization. 541 // initialization.
552 struct PipelineInitState; 542 struct PipelineInitState;
553 scoped_ptr<PipelineInitState> pipeline_init_state_; 543 scoped_ptr<PipelineInitState> pipeline_init_state_;
554 544
555 // Statistics. 545 // Statistics.
556 PipelineStatistics statistics_; 546 PipelineStatistics statistics_;
557 // Time of pipeline creation; is non-zero only until the pipeline first 547 // Time of pipeline creation; is non-zero only until the pipeline first
558 // reaches "kStarted", at which point it is used & zeroed out. 548 // reaches "kStarted", at which point it is used & zeroed out.
559 base::Time creation_time_; 549 base::Time creation_time_;
560 550
561 scoped_ptr<SerialRunner> pending_callbacks_; 551 scoped_ptr<SerialRunner> pending_callbacks_;
562 552
563 DISALLOW_COPY_AND_ASSIGN(Pipeline); 553 DISALLOW_COPY_AND_ASSIGN(Pipeline);
564 }; 554 };
565 555
566 } // namespace media 556 } // namespace media
567 557
568 #endif // MEDIA_BASE_PIPELINE_H_ 558 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698