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

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

Issue 10918022: Move AudioDecoder initialization into AudioRenderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | 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"
11 #include "base/synchronization/condition_variable.h" 11 #include "base/synchronization/condition_variable.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "media/base/audio_renderer.h"
15 #include "media/base/demuxer.h" 14 #include "media/base/demuxer.h"
16 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
17 #include "media/base/pipeline_status.h" 16 #include "media/base/pipeline_status.h"
18 #include "media/base/ranges.h" 17 #include "media/base/ranges.h"
19 #include "media/base/serial_runner.h" 18 #include "media/base/serial_runner.h"
20 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
21 20
22 class MessageLoop; 21 class MessageLoop;
23 22
24 namespace base { 23 namespace base {
25 class MessageLoopProxy; 24 class MessageLoopProxy;
26 class TimeDelta; 25 class TimeDelta;
27 } 26 }
28 27
29 namespace media { 28 namespace media {
30 29
31 class AudioDecoder; 30 class AudioRenderer;
32 class Clock; 31 class Clock;
33 class FilterCollection; 32 class FilterCollection;
34 class MediaLog; 33 class MediaLog;
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
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 friend class MediaLog; 224 friend class MediaLog;
226 225
227 // Only allow ourselves to be deleted by reference counting. 226 // Only allow ourselves to be deleted by reference counting.
228 friend class base::RefCountedThreadSafe<Pipeline>; 227 friend class base::RefCountedThreadSafe<Pipeline>;
229 virtual ~Pipeline(); 228 virtual ~Pipeline();
230 229
231 // Pipeline states, as described above. 230 // Pipeline states, as described above.
232 enum State { 231 enum State {
233 kCreated, 232 kCreated,
234 kInitDemuxer, 233 kInitDemuxer,
235 kInitAudioDecoder,
236 kInitAudioRenderer, 234 kInitAudioRenderer,
237 kInitVideoRenderer, 235 kInitVideoRenderer,
238 kInitPrerolling, 236 kInitPrerolling,
239 kSeeking, 237 kSeeking,
240 kStarting, 238 kStarting,
241 kStarted, 239 kStarted,
242 kStopping, 240 kStopping,
243 kStopped, 241 kStopped,
244 }; 242 };
245 243
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 void DoAudioRendererEnded(); 314 void DoAudioRendererEnded();
317 void DoVideoRendererEnded(); 315 void DoVideoRendererEnded();
318 void RunEndedCallbackIfNeeded(); 316 void RunEndedCallbackIfNeeded();
319 317
320 // Carries out disabling the audio renderer. 318 // Carries out disabling the audio renderer.
321 void AudioDisabledTask(); 319 void AudioDisabledTask();
322 320
323 // Kicks off initialization for each media object, executing |done_cb| with 321 // Kicks off initialization for each media object, executing |done_cb| with
324 // the result when completed. 322 // the result when completed.
325 void InitializeDemuxer(const PipelineStatusCB& done_cb); 323 void InitializeDemuxer(const PipelineStatusCB& done_cb);
326 void InitializeAudioDecoder(const PipelineStatusCB& done_cb);
327 void InitializeAudioRenderer(const PipelineStatusCB& done_cb); 324 void InitializeAudioRenderer(const PipelineStatusCB& done_cb);
328 void InitializeVideoRenderer(const PipelineStatusCB& done_cb); 325 void InitializeVideoRenderer(const PipelineStatusCB& done_cb);
329 326
330 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask(). 327 // Kicks off destroying filters. Called by StopTask() and ErrorChangedTask().
331 // When we start to tear down the pipeline, we will consider two cases: 328 // When we start to tear down the pipeline, we will consider two cases:
332 // 1. when pipeline has not been initialized, we will transit to stopping 329 // 1. when pipeline has not been initialized, we will transit to stopping
333 // state first. 330 // state first.
334 // 2. when pipeline has been initialized, we will first transit to pausing 331 // 2. when pipeline has been initialized, we will first transit to pausing
335 // => flushing => stopping => stopped state. 332 // => flushing => stopping => stopped state.
336 // This will remove the race condition during stop between filters. 333 // This will remove the race condition during stop between filters.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // and for signalling imminent shutdown. 457 // and for signalling imminent shutdown.
461 // The signalling imminent shutdown is a HACK necessary because 458 // The signalling imminent shutdown is a HACK necessary because
462 // WebMediaPlayerImpl::Destroy() holds the render thread loop hostage 459 // WebMediaPlayerImpl::Destroy() holds the render thread loop hostage
463 // until PipelineImpl::Stop() calls its callback. 460 // until PipelineImpl::Stop() calls its callback.
464 // http://crbug.com/110228 tracks removing this hack. 461 // http://crbug.com/110228 tracks removing this hack.
465 scoped_refptr<VideoRenderer> video_renderer_; 462 scoped_refptr<VideoRenderer> video_renderer_;
466 463
467 // Demuxer reference used for setting the preload value. 464 // Demuxer reference used for setting the preload value.
468 scoped_refptr<Demuxer> demuxer_; 465 scoped_refptr<Demuxer> demuxer_;
469 466
470 // Audio decoder reference used during initialization.
471 //
472 // TODO(scherkus): Remove after renderers do initialization, see
473 // http://crbug.com/145635
474 scoped_refptr<AudioDecoder> audio_decoder_;
475
476 PipelineStatistics statistics_; 467 PipelineStatistics statistics_;
477 468
478 // Time of pipeline creation; is non-zero only until the pipeline first 469 // Time of pipeline creation; is non-zero only until the pipeline first
479 // reaches "kStarted", at which point it is used & zeroed out. 470 // reaches "kStarted", at which point it is used & zeroed out.
480 base::Time creation_time_; 471 base::Time creation_time_;
481 472
482 scoped_ptr<SerialRunner> pending_callbacks_; 473 scoped_ptr<SerialRunner> pending_callbacks_;
483 474
484 base::ThreadChecker thread_checker_; 475 base::ThreadChecker thread_checker_;
485 476
486 DISALLOW_COPY_AND_ASSIGN(Pipeline); 477 DISALLOW_COPY_AND_ASSIGN(Pipeline);
487 }; 478 };
488 479
489 } // namespace media 480 } // namespace media
490 481
491 #endif // MEDIA_BASE_PIPELINE_H_ 482 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698