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

Unified Diff: chromecast/media/cma/pipeline/media_pipeline_impl.h

Issue 741863002: Chromecast: adds a media pipeline feeding data to CMA device backends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cma-cdm
Patch Set: address nits, merge Pause/Flush Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/media/cma/pipeline/media_pipeline_impl.h
diff --git a/chromecast/media/cma/pipeline/media_pipeline_impl.h b/chromecast/media/cma/pipeline/media_pipeline_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..0b7a8e71675483fba4e5adb19070223a16a4cdbe
--- /dev/null
+++ b/chromecast/media/cma/pipeline/media_pipeline_impl.h
@@ -0,0 +1,112 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_
+#define CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_
+
+#include "base/basictypes.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread_checker.h"
+#include "chromecast/media/cma/pipeline/load_type.h"
+#include "chromecast/media/cma/pipeline/media_pipeline.h"
+#include "chromecast/media/cma/pipeline/media_pipeline_client.h"
+#include "media/base/serial_runner.h"
+
+namespace chromecast {
+namespace media {
+class AudioPipelineImpl;
+class BufferingController;
+class MediaClockDevice;
+class MediaPipelineDevice;
+class VideoPipelineImpl;
+
+class MediaPipelineImpl : public MediaPipeline {
+ public:
+ MediaPipelineImpl();
+ ~MediaPipelineImpl() override;
+
+ // Initialize the media pipeline: the pipeline is configured based on
+ // |load_type|.
+ void Initialize(LoadType load_type,
+ scoped_ptr<MediaPipelineDevice> media_pipeline_device);
+
+ // MediaPipeline implementation.
+ void SetClient(const MediaPipelineClient& client) override;
+ void SetCdm(int cdm_id) override;
+ AudioPipeline* GetAudioPipeline() const override;
+ VideoPipeline* GetVideoPipeline() const override;
+ void InitializeAudio(
+ const ::media::AudioDecoderConfig& config,
+ scoped_ptr<CodedFrameProvider> frame_provider,
+ const ::media::PipelineStatusCB& status_cb) override;
+ void InitializeVideo(
+ const ::media::VideoDecoderConfig& config,
+ scoped_ptr<CodedFrameProvider> frame_provider,
+ const ::media::PipelineStatusCB& status_cb) override;
+ void StartPlayingFrom(base::TimeDelta time) override;
+ void Flush(const ::media::PipelineStatusCB& status_cb) override;
+ void Stop() override;
+ void SetPlaybackRate(float playback_rate) override;
+
+ AudioPipelineImpl* GetAudioPipelineImpl() const;
+ VideoPipelineImpl* GetVideoPipelineImpl() const;
+
+ void SetCdm(::media::BrowserCdm* cdm);
+
+ private:
+ void StateTransition(const ::media::PipelineStatusCB& status_cb,
+ ::media::PipelineStatus status);
+
+ // Invoked to notify about a change of buffering state.
+ void OnBufferingNotification(bool is_buffering);
+
+ void UpdateMediaTime();
+
+ void OnError(::media::PipelineStatus error);
+
+ base::ThreadChecker thread_checker_;
+
+ MediaPipelineClient client_;
+
+ scoped_ptr<BufferingController> buffering_controller_;
+
+ // Interface with the underlying hardware media pipeline.
+ scoped_ptr<MediaPipelineDevice> media_pipeline_device_;
+ MediaClockDevice* clock_device_;
+
+ bool has_audio_;
+ bool has_video_;
+ scoped_ptr<AudioPipelineImpl> audio_pipeline_;
+ scoped_ptr<VideoPipelineImpl> video_pipeline_;
+ scoped_ptr< ::media::SerialRunner> pending_callbacks_;
+
+ // Playback rate set by the upper layer.
+ float target_playback_rate_;
+
+ // Indicate a possible re-buffering phase.
+ bool is_buffering_;
+
+ // The media time is retrieved at regular intervals.
+ // Indicate whether time update is enabled.
+ bool enable_time_update_;
+ bool pending_time_update_task_;
+ base::TimeDelta last_media_time_;
+
+ // Used to make the statistics update period a multiplier of the time update
+ // period.
+ int statistics_rolling_counter_;
+
+ base::WeakPtrFactory<MediaPipelineImpl> weak_factory_;
+ base::WeakPtr<MediaPipelineImpl> weak_this_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaPipelineImpl);
+};
+
+} // namespace media
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CMA_PIPELINE_MEDIA_PIPELINE_IMPL_H_
« no previous file with comments | « chromecast/media/cma/pipeline/media_pipeline_client.cc ('k') | chromecast/media/cma/pipeline/media_pipeline_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698