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 "media/cast/sender/video_sender.h" | 5 #include "media/cast/sender/video_sender.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | |
9 #include <algorithm> | 8 #include <algorithm> |
10 #include <cmath> | 9 #include <cmath> |
11 #include <cstring> | 10 #include <cstring> |
| 11 #include <utility> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 #include "media/cast/cast_defines.h" | 16 #include "media/cast/cast_defines.h" |
17 #include "media/cast/net/cast_transport_config.h" | 17 #include "media/cast/net/cast_transport_config.h" |
18 #include "media/cast/sender/performance_metrics_overlay.h" | 18 #include "media/cast/sender/performance_metrics_overlay.h" |
19 #include "media/cast/sender/video_encoder.h" | 19 #include "media/cast/sender/video_encoder.h" |
20 | 20 |
21 namespace media { | 21 namespace media { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 &capture_begin_event->timestamp) || | 63 &capture_begin_event->timestamp) || |
64 !video_frame.metadata()->GetTimeTicks( | 64 !video_frame.metadata()->GetTimeTicks( |
65 media::VideoFrameMetadata::CAPTURE_END_TIME, | 65 media::VideoFrameMetadata::CAPTURE_END_TIME, |
66 &capture_end_event->timestamp)) { | 66 &capture_end_event->timestamp)) { |
67 // The frame capture timestamps were not provided by the video capture | 67 // The frame capture timestamps were not provided by the video capture |
68 // source. Simply log the events as happening right now. | 68 // source. Simply log the events as happening right now. |
69 capture_begin_event->timestamp = capture_end_event->timestamp = | 69 capture_begin_event->timestamp = capture_end_event->timestamp = |
70 cast_environment->Clock()->NowTicks(); | 70 cast_environment->Clock()->NowTicks(); |
71 } | 71 } |
72 | 72 |
73 cast_environment->logger()->DispatchFrameEvent(capture_begin_event.Pass()); | 73 cast_environment->logger()->DispatchFrameEvent( |
74 cast_environment->logger()->DispatchFrameEvent(capture_end_event.Pass()); | 74 std::move(capture_begin_event)); |
| 75 cast_environment->logger()->DispatchFrameEvent(std::move(capture_end_event)); |
75 } | 76 } |
76 | 77 |
77 } // namespace | 78 } // namespace |
78 | 79 |
79 // Note, we use a fixed bitrate value when external video encoder is used. | 80 // Note, we use a fixed bitrate value when external video encoder is used. |
80 // Some hardware encoder shows bad behavior if we set the bitrate too | 81 // Some hardware encoder shows bad behavior if we set the bitrate too |
81 // frequently, e.g. quality drop, not abiding by target bitrate, etc. | 82 // frequently, e.g. quality drop, not abiding by target bitrate, etc. |
82 // See details: crbug.com/392086. | 83 // See details: crbug.com/392086. |
83 VideoSender::VideoSender( | 84 VideoSender::VideoSender( |
84 scoped_refptr<CastEnvironment> cast_environment, | 85 scoped_refptr<CastEnvironment> cast_environment, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (attenuated_utilization >= 0.0) { | 379 if (attenuated_utilization >= 0.0) { |
379 // Key frames are artificially capped to 1.0 because their actual | 380 // Key frames are artificially capped to 1.0 because their actual |
380 // utilization is atypical compared to the other frames in the stream, and | 381 // utilization is atypical compared to the other frames in the stream, and |
381 // this can misguide the producer of the input video frames. | 382 // this can misguide the producer of the input video frames. |
382 video_frame->metadata()->SetDouble( | 383 video_frame->metadata()->SetDouble( |
383 media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 384 media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
384 encoded_frame->dependency == EncodedFrame::KEY ? | 385 encoded_frame->dependency == EncodedFrame::KEY ? |
385 std::min(1.0, attenuated_utilization) : attenuated_utilization); | 386 std::min(1.0, attenuated_utilization) : attenuated_utilization); |
386 } | 387 } |
387 | 388 |
388 SendEncodedFrame(encoder_bitrate, encoded_frame.Pass()); | 389 SendEncodedFrame(encoder_bitrate, std::move(encoded_frame)); |
389 } | 390 } |
390 | 391 |
391 } // namespace cast | 392 } // namespace cast |
392 } // namespace media | 393 } // namespace media |
OLD | NEW |