| 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 "content/renderer/media/media_stream_video_capturer_source.h" | 5 #include "content/renderer/media/media_stream_video_capturer_source.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 void DisconnectFromTrack() { | 346 void DisconnectFromTrack() { |
| 347 MediaStreamVideoSink::DisconnectFromTrack(); | 347 MediaStreamVideoSink::DisconnectFromTrack(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame, | 350 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame, |
| 351 base::TimeTicks capture_time) { | 351 base::TimeTicks capture_time) { |
| 352 *capture_time_ = capture_time; | 352 *capture_time_ = capture_time; |
| 353 metadata_->Clear(); | 353 metadata_->Clear(); |
| 354 base::DictionaryValue tmp; | 354 metadata_->MergeMetadataFrom(frame->metadata()); |
| 355 frame->metadata()->MergeInternalValuesInto(&tmp); | |
| 356 metadata_->MergeInternalValuesFrom(tmp); | |
| 357 base::ResetAndReturn(&got_frame_cb_).Run(); | 355 base::ResetAndReturn(&got_frame_cb_).Run(); |
| 358 } | 356 } |
| 359 | 357 |
| 360 private: | 358 private: |
| 361 base::TimeTicks* const capture_time_; | 359 base::TimeTicks* const capture_time_; |
| 362 media::VideoFrameMetadata* const metadata_; | 360 media::VideoFrameMetadata* const metadata_; |
| 363 base::Closure got_frame_cb_; | 361 base::Closure got_frame_cb_; |
| 364 }; | 362 }; |
| 365 | 363 |
| 366 TEST_F(MediaStreamVideoCapturerSourceTest, CaptureTimeAndMetadataPlumbing) { | 364 TEST_F(MediaStreamVideoCapturerSourceTest, CaptureTimeAndMetadataPlumbing) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 run_loop.Run(); | 396 run_loop.Run(); |
| 399 fake_sink.DisconnectFromTrack(); | 397 fake_sink.DisconnectFromTrack(); |
| 400 EXPECT_EQ(reference_capture_time, capture_time); | 398 EXPECT_EQ(reference_capture_time, capture_time); |
| 401 double metadata_value; | 399 double metadata_value; |
| 402 EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, | 400 EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, |
| 403 &metadata_value)); | 401 &metadata_value)); |
| 404 EXPECT_EQ(30.0, metadata_value); | 402 EXPECT_EQ(30.0, metadata_value); |
| 405 } | 403 } |
| 406 | 404 |
| 407 } // namespace content | 405 } // namespace content |
| OLD | NEW |