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

Unified Diff: chromecast/media/cma/backend/media_component_device_feeder_for_test.h

Issue 622853002: Chromecast: adds interfaces for hardware layer of CMA pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cma-decrypt-context
Patch Set: rebased onto CMA testing CL Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/media/cma/backend/media_component_device_feeder_for_test.h
diff --git a/chromecast/media/cma/backend/media_component_device_feeder_for_test.h b/chromecast/media/cma/backend/media_component_device_feeder_for_test.h
new file mode 100644
index 0000000000000000000000000000000000000000..8580e0876038037ad7b6c68fe5d990b368c22796
--- /dev/null
+++ b/chromecast/media/cma/backend/media_component_device_feeder_for_test.h
@@ -0,0 +1,87 @@
+// 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_BACKEND_MEDIA_COMPONENT_DEVICE_FEEDER_FOR_TEST_H_
+#define CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_COMPONENT_DEVICE_FEEDER_FOR_TEST_H_
+
+#include <list>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "chromecast/media/cma/backend/audio_pipeline_device.h"
+#include "chromecast/media/cma/backend/media_clock_device.h"
+#include "chromecast/media/cma/backend/media_pipeline_device.h"
+#include "chromecast/media/cma/backend/video_pipeline_device.h"
+#include "chromecast/media/cma/base/decoder_buffer_base.h"
+
+namespace chromecast {
+namespace media {
+
+typedef std::list<scoped_refptr<DecoderBufferBase> > FrameList;
+
+class MediaComponentDeviceFeeder :
+ public base::RefCounted<MediaComponentDeviceFeeder> {
+ public:
+ MediaComponentDeviceFeeder(MediaComponentDevice *device,
+ MediaClockDevice *clock,
+ const FrameList& frames);
+
+ void Initialize();
+
+ // Feed one frame into the pipeline.
+ void Feed();
+ void Pause();
+
+ void SetEosCB(base::Callback<void()> eos_cb);
+ void SetFrameCountBetweenPause(int frame_count);
+ void SetDelayedFeedPattern(const std::vector<bool>& pattern);
+
+ protected:
+ friend class base::RefCounted<MediaComponentDeviceFeeder>;
+ virtual ~MediaComponentDeviceFeeder();
+
+ private:
+
+ void OnFramePushed(MediaComponentDevice::FrameStatus status);
+ void OnPauseCompleted();
+
+ void OnEos();
+
+ MediaClockDevice *media_clock_device_;
+ MediaComponentDevice *media_component_device_;
+ FrameList frames_;
+
+ // Frame index where the audio device is switching to the kStateRunning.
+ int rendering_frame_idx_;
+
+ // Frame index where the clock device is switching to the kStateRunning
+ int clock_frame_idx_;
+
+ // Timing pattern to feed the pipeline.
+ std::vector<bool> delayed_feed_pattern_;
+ size_t delayed_feed_pattern_idx_;
+
+ // Issue a pause at regular intervals.
+ int frame_count_between_pause_;
+ int frame_count_since_last_pause_;
+
+ // Set to enable eos callback
+ base::Callback<void()> eos_cb_;
+
+ // Current media time.
+ base::TimeDelta media_time_;
+
+ bool feeding_completed_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaComponentDeviceFeeder);
+};
+
+} // namespace media
+} // namespace chromecast
+
+#endif // CHROMECAST_MEDIA_CMA_BACKEND_MEDIA_COMPONENT_DEVICE_FEEDER_FOR_TEST_H_

Powered by Google App Engine
This is Rietveld 408576698