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

Side by Side Diff: services/media/audio/audio_track_impl.cc

Issue 2006093004: Motown: Convert MediaSink to expose MediaTimelineControlSite (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "mojo/services/media/common/cpp/linear_transform.h" 9 #include "mojo/services/media/common/cpp/linear_transform.h"
10 #include "mojo/services/media/common/cpp/timeline.h" 10 #include "mojo/services/media/common/cpp/timeline.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 rate_in_frames_per_ns.reference_delta(), 324 rate_in_frames_per_ns.reference_delta(),
325 timeline_function.subject_time() * frames_per_ns_); 325 timeline_function.subject_time() * frames_per_ns_);
326 } 326 }
327 327
328 void AudioTrackImpl::OnPacketReceived(AudioPipe::AudioPacketRefPtr packet) { 328 void AudioTrackImpl::OnPacketReceived(AudioPipe::AudioPacketRefPtr packet) {
329 DCHECK(packet); 329 DCHECK(packet);
330 for (const auto& output : outputs_) { 330 for (const auto& output : outputs_) {
331 DCHECK(output); 331 DCHECK(output);
332 output->PushToPendingQueue(packet); 332 output->PushToPendingQueue(packet);
333 } 333 }
334
335 if (packet->state()->packet()->end_of_stream) {
336 timeline_control_site_.SetEndOfStreamPts(
337 (packet->state()->packet()->pts + packet->frame_count()) /
338 frames_per_ns_);
339 }
334 } 340 }
335 341
336 bool AudioTrackImpl::OnFlushRequested(const MediaConsumer::FlushCallback& cbk) { 342 bool AudioTrackImpl::OnFlushRequested(const MediaConsumer::FlushCallback& cbk) {
337 for (const auto& output : outputs_) { 343 for (const auto& output : outputs_) {
338 DCHECK(output); 344 DCHECK(output);
339 output->FlushPendingQueue(); 345 output->FlushPendingQueue();
340 } 346 }
341 cbk.Run(); 347 cbk.Run();
342 return true; 348 return true;
343 } 349 }
344 350
345 } // namespace audio 351 } // namespace audio
346 } // namespace media 352 } // namespace media
347 } // namespace mojo 353 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698