| OLD | NEW |
| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 // implementations, and scheduling a job to recalculate the properties for the | 252 // implementations, and scheduling a job to recalculate the properties for the |
| 253 // dirty tracks and notify the users as appropriate. | 253 // dirty tracks and notify the users as appropriate. |
| 254 | 254 |
| 255 // If we cannot promote our own weak pointer, something is seriously wrong. | 255 // If we cannot promote our own weak pointer, something is seriously wrong. |
| 256 AudioTrackImplPtr strong_this(weak_this_.lock()); | 256 AudioTrackImplPtr strong_this(weak_this_.lock()); |
| 257 DCHECK(strong_this); | 257 DCHECK(strong_this); |
| 258 DCHECK(owner_); | 258 DCHECK(owner_); |
| 259 owner_->GetOutputManager().SelectOutputsForTrack(strong_this); | 259 owner_->GetOutputManager().SelectOutputsForTrack(strong_this); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void AudioTrackImpl::GetConsumer( | 262 void AudioTrackImpl::GetPacketConsumer( |
| 263 InterfaceRequest<MediaConsumer> consumer_request) { | 263 InterfaceRequest<MediaPacketConsumer> consumer_request) { |
| 264 // Bind our pipe to the interface request. | 264 // Bind our pipe to the interface request. |
| 265 if (pipe_.Init(consumer_request.Pass()) != MOJO_RESULT_OK) { | 265 if (pipe_.Init(consumer_request.Pass()) != MOJO_RESULT_OK) { |
| 266 LOG(ERROR) << "Failed to media pipe to interface request."; | 266 LOG(ERROR) << "Failed to media pipe to interface request."; |
| 267 Shutdown(); | 267 Shutdown(); |
| 268 return; | 268 return; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 void AudioTrackImpl::GetTimelineControlPoint( | 272 void AudioTrackImpl::GetTimelineControlPoint( |
| 273 InterfaceRequest<MediaTimelineControlPoint> req) { | 273 InterfaceRequest<MediaTimelineControlPoint> req) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 output->PushToPendingQueue(packet); | 336 output->PushToPendingQueue(packet); |
| 337 } | 337 } |
| 338 | 338 |
| 339 if (packet->state()->packet()->end_of_stream) { | 339 if (packet->state()->packet()->end_of_stream) { |
| 340 timeline_control_point_.SetEndOfStreamPts( | 340 timeline_control_point_.SetEndOfStreamPts( |
| 341 (packet->state()->packet()->pts + packet->frame_count()) / | 341 (packet->state()->packet()->pts + packet->frame_count()) / |
| 342 frames_per_ns_); | 342 frames_per_ns_); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 bool AudioTrackImpl::OnFlushRequested(const MediaConsumer::FlushCallback& cbk) { | 346 bool AudioTrackImpl::OnFlushRequested( |
| 347 const MediaPacketConsumer::FlushCallback& cbk) { |
| 347 for (const auto& output : outputs_) { | 348 for (const auto& output : outputs_) { |
| 348 DCHECK(output); | 349 DCHECK(output); |
| 349 output->FlushPendingQueue(); | 350 output->FlushPendingQueue(); |
| 350 } | 351 } |
| 351 cbk.Run(); | 352 cbk.Run(); |
| 352 return true; | 353 return true; |
| 353 } | 354 } |
| 354 | 355 |
| 355 } // namespace audio | 356 } // namespace audio |
| 356 } // namespace media | 357 } // namespace media |
| 357 } // namespace mojo | 358 } // namespace mojo |
| OLD | NEW |