| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback_helpers.h" | 6 #include "base/callback_helpers.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 public: | 258 public: |
| 259 FakeMediaStreamVideoSink(base::TimeTicks* capture_time, | 259 FakeMediaStreamVideoSink(base::TimeTicks* capture_time, |
| 260 media::VideoFrameMetadata* metadata, | 260 media::VideoFrameMetadata* metadata, |
| 261 base::Closure got_frame_cb) | 261 base::Closure got_frame_cb) |
| 262 : capture_time_(capture_time), | 262 : capture_time_(capture_time), |
| 263 metadata_(metadata), | 263 metadata_(metadata), |
| 264 got_frame_cb_(got_frame_cb) { | 264 got_frame_cb_(got_frame_cb) { |
| 265 } | 265 } |
| 266 | 266 |
| 267 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame, | 267 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame, |
| 268 const base::TimeTicks& capture_time) { | 268 base::TimeTicks capture_time) { |
| 269 *capture_time_ = capture_time; | 269 *capture_time_ = capture_time; |
| 270 metadata_->Clear(); | 270 metadata_->Clear(); |
| 271 base::DictionaryValue tmp; | 271 base::DictionaryValue tmp; |
| 272 frame->metadata()->MergeInternalValuesInto(&tmp); | 272 frame->metadata()->MergeInternalValuesInto(&tmp); |
| 273 metadata_->MergeInternalValuesFrom(tmp); | 273 metadata_->MergeInternalValuesFrom(tmp); |
| 274 base::ResetAndReturn(&got_frame_cb_).Run(); | 274 base::ResetAndReturn(&got_frame_cb_).Run(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 private: | 277 private: |
| 278 base::TimeTicks* const capture_time_; | 278 base::TimeTicks* const capture_time_; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 run_loop.Run(); | 318 run_loop.Run(); |
| 319 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track); | 319 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track); |
| 320 EXPECT_EQ(reference_capture_time, capture_time); | 320 EXPECT_EQ(reference_capture_time, capture_time); |
| 321 double metadata_value; | 321 double metadata_value; |
| 322 EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, | 322 EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, |
| 323 &metadata_value)); | 323 &metadata_value)); |
| 324 EXPECT_EQ(30.0, metadata_value); | 324 EXPECT_EQ(30.0, metadata_value); |
| 325 } | 325 } |
| 326 | 326 |
| 327 } // namespace content | 327 } // namespace content |
| OLD | NEW |