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

Side by Side Diff: services/media/factory_service/media_sink_impl.cc

Issue 1814553002: Motown: Improvements to packet definition (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Added a comment. Created 4 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/logging.h" 5 #include "base/logging.h"
6 #include "mojo/services/media/common/cpp/linear_transform.h" 6 #include "mojo/services/media/common/cpp/linear_transform.h"
7 #include "mojo/services/media/common/cpp/local_time.h" 7 #include "mojo/services/media/common/cpp/local_time.h"
8 #include "services/media/factory_service/media_sink_impl.h" 8 #include "services/media/factory_service/media_sink_impl.h"
9 #include "services/media/framework/conversion_pipeline_builder.h" 9 #include "services/media/framework/conversion_pipeline_builder.h"
10 #include "services/media/framework_mojo/mojo_type_conversions.h" 10 #include "services/media/framework_mojo/mojo_type_conversions.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // TODO(dalesat): start_local_time should be supplied via the mojo interface. 233 // TODO(dalesat): start_local_time should be supplied via the mojo interface.
234 // For now, it's hard-coded to be 30ms in the future. 234 // For now, it's hard-coded to be 30ms in the future.
235 // The local time when we want the rate to change. 235 // The local time when we want the rate to change.
236 int64_t start_local_time = 236 int64_t start_local_time =
237 (LocalClock::now().time_since_epoch() + std::chrono::milliseconds(30)). 237 (LocalClock::now().time_since_epoch() + std::chrono::milliseconds(30)).
238 count(); 238 count();
239 239
240 // The media time corresponding to start_local_time. 240 // The media time corresponding to start_local_time.
241 int64_t start_media_time; 241 int64_t start_media_time;
242 if (flushed_ && 242 if (flushed_ &&
243 producer_->GetFirstPresentationTimeSinceFlush() != 243 producer_->GetFirstPtsSinceFlush() != Packet::kUnknownPts) {
244 Packet::kUnknownPresentationTime) {
245 // We're getting started initially or after a flush/prime, so the media 244 // We're getting started initially or after a flush/prime, so the media
246 // time corresponding to start_local_time should be the PTS of 245 // time corresponding to start_local_time should be the PTS of
247 // the first packet. 246 // the first packet.
248 start_media_time = producer_->GetFirstPresentationTimeSinceFlush(); 247 start_media_time = producer_->GetFirstPtsSinceFlush();
249 } else { 248 } else {
250 // We're resuming, so the media time corresponding to start_local_time can 249 // We're resuming, so the media time corresponding to start_local_time can
251 // be calculated using the existing transform. 250 // be calculated using the existing transform.
252 success = 251 success =
253 transform_.DoForwardTransform(start_local_time, &start_media_time); 252 transform_.DoForwardTransform(start_local_time, &start_media_time);
254 DCHECK(success) 253 DCHECK(success)
255 << "LinearTransform::DoForwardTransform reports loss of precision"; 254 << "LinearTransform::DoForwardTransform reports loss of precision";
256 } 255 }
257 256
258 flushed_ = false; 257 flushed_ = false;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 LinearTransform::Ratio::Reduce( 306 LinearTransform::Ratio::Reduce(
308 &status_transform_->quad->reference_delta, 307 &status_transform_->quad->reference_delta,
309 &status_transform_->quad->target_delta); 308 &status_transform_->quad->target_delta);
310 309
311 rate_ = target_rate_; 310 rate_ = target_rate_;
312 StatusUpdated(); 311 StatusUpdated();
313 } 312 }
314 313
315 } // namespace media 314 } // namespace media
316 } // namespace mojo 315 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/media/common/interfaces/media_transport.mojom ('k') | services/media/framework/formatting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698