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

Unified Diff: services/media/framework_mojo/audio_track_producer.cc

Issue 1692443002: Motown: Framework parts for mojo transport (producer/consumer/mediapipe) and control (audiotrack). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Added comments to AudioTrackController::SetRate regarding the proper way to implement it. Created 4 years, 10 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: services/media/framework_mojo/audio_track_producer.cc
diff --git a/services/media/framework_mojo/audio_track_producer.cc b/services/media/framework_mojo/audio_track_producer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..275848e1bff74b8e125dbd1535c65a0c9cf39d5a
--- /dev/null
+++ b/services/media/framework_mojo/audio_track_producer.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 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.
+
+#include "base/logging.h"
+#include "services/media/framework_mojo/audio_track_producer.h"
+
+namespace mojo {
+namespace media {
+
+AudioTrackProducer::AudioTrackProducer(MediaPipePtr pipe) :
+ pipe_(pipe.Pass()) {
+ DCHECK(pipe_.is_bound());
+
+ DCHECK(!mojo_allocator_.initialized());
+ mojo_allocator_.InitNew(256 * 1024); // TODO(dalesat): Made up!
+
+ pipe_->SetBuffer(
+ mojo_allocator_.GetDuplicateHandle(),
+ mojo_allocator_.size());
+}
+
+AudioTrackProducer::~AudioTrackProducer() {}
+
+bool AudioTrackProducer::IsConnected() {
+ return pipe_.is_bound();
+}
+
+void AudioTrackProducer::PushPacketInternal(
+ Packet* packet_raw_ptr,
+ MediaPacketPtr media_packet) {
+ DCHECK(pipe_.is_bound());
+ pipe_->SendPacket(
+ media_packet.Pass(),
+ [this, packet_raw_ptr](MediaPipe::SendResult result) {
+ PacketPtr packet = PacketPtr(packet_raw_ptr);
+ PushCompleted(packet);
+ });
+}
+
+void AudioTrackProducer::FlushPipe(const FlushPipeCallback& callback) {
+ DCHECK(pipe_.is_bound());
+ pipe_->Flush(callback);
+}
+
+} // namespace media
+} // namespace mojo
« no previous file with comments | « services/media/framework_mojo/audio_track_producer.h ('k') | services/media/framework_mojo/mojo_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698