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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc

Issue 2636443002: Add experimental simulcast screen content mode (Closed)
Patch Set: Created 3 years, 11 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 (c) 2013 The WebRTC project authors. All Rights Reserved. 1 /* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
2 * 2 *
3 * Use of this source code is governed by a BSD-style license 3 * Use of this source code is governed by a BSD-style license
4 * that can be found in the LICENSE file in the root of the source 4 * that can be found in the LICENSE file in the root of the source
5 * tree. An additional intellectual property rights grant can be found 5 * tree. An additional intellectual property rights grant can be found
6 * in the file PATENTS. All contributing project authors may 6 * in the file PATENTS. All contributing project authors may
7 * be found in the AUTHORS file in the root of the source tree. 7 * be found in the AUTHORS file in the root of the source tree.
8 */ 8 */
9 9
10 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h" 10 #include "webrtc/modules/video_coding/codecs/vp8/screenshare_layers.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 VP8_EFLAG_NO_UPD_LAST; 48 VP8_EFLAG_NO_UPD_LAST;
49 49
50 // Always emit a frame with certain interval, even if bitrate targets have 50 // Always emit a frame with certain interval, even if bitrate targets have
51 // been exceeded. 51 // been exceeded.
52 const int ScreenshareLayers::kMaxFrameIntervalMs = 2000; 52 const int ScreenshareLayers::kMaxFrameIntervalMs = 2000;
53 53
54 webrtc::TemporalLayers* ScreenshareTemporalLayersFactory::Create( 54 webrtc::TemporalLayers* ScreenshareTemporalLayersFactory::Create(
55 int simulcast_id, 55 int simulcast_id,
56 int num_temporal_layers, 56 int num_temporal_layers,
57 uint8_t initial_tl0_pic_idx) const { 57 uint8_t initial_tl0_pic_idx) const {
58 webrtc::TemporalLayers* tl = new webrtc::ScreenshareLayers( 58 webrtc::TemporalLayers* tl;
59 num_temporal_layers, rand(), webrtc::Clock::GetRealTimeClock()); 59 if (simulcast_id == 0) {
60 tl = new webrtc::ScreenshareLayers(num_temporal_layers, rand(),
61 webrtc::Clock::GetRealTimeClock());
62 } else {
63 RealTimeTemporalLayersFactory rt_tl_factory;
64 tl = rt_tl_factory.Create(simulcast_id, num_temporal_layers, rand());
65 }
60 if (listener_) 66 if (listener_)
61 listener_->OnTemporalLayersCreated(simulcast_id, tl); 67 listener_->OnTemporalLayersCreated(simulcast_id, tl);
62 return tl; 68 return tl;
63 } 69 }
64 70
65 ScreenshareLayers::ScreenshareLayers(int num_temporal_layers, 71 ScreenshareLayers::ScreenshareLayers(int num_temporal_layers,
66 uint8_t initial_tl0_pic_idx, 72 uint8_t initial_tl0_pic_idx,
67 Clock* clock) 73 Clock* clock)
68 : clock_(clock), 74 : clock_(clock),
69 number_of_temporal_layers_(num_temporal_layers), 75 number_of_temporal_layers_(std::min(2, num_temporal_layers)),
åsapersson 2017/01/16 13:43:50 maybe add a constant for 2
sprang_webrtc 2017/01/16 16:39:10 Done.
70 last_base_layer_sync_(false), 76 last_base_layer_sync_(false),
71 tl0_pic_idx_(initial_tl0_pic_idx), 77 tl0_pic_idx_(initial_tl0_pic_idx),
72 active_layer_(-1), 78 active_layer_(-1),
73 last_timestamp_(-1), 79 last_timestamp_(-1),
74 last_sync_timestamp_(-1), 80 last_sync_timestamp_(-1),
75 last_emitted_tl0_timestamp_(-1), 81 last_emitted_tl0_timestamp_(-1),
76 min_qp_(-1), 82 min_qp_(-1),
77 max_qp_(-1), 83 max_qp_(-1),
78 max_debt_bytes_(0), 84 max_debt_bytes_(0),
79 encode_framerate_(1000.0f, 1000.0f), // 1 second window, second scale. 85 encode_framerate_(1000.0f, 1000.0f), // 1 second window, second scale.
80 bitrate_updated_(false) { 86 bitrate_updated_(false) {
81 RTC_CHECK_GT(num_temporal_layers, 0); 87 RTC_CHECK_GT(number_of_temporal_layers_, 0);
82 RTC_CHECK_LE(num_temporal_layers, 2); 88 RTC_CHECK_LE(number_of_temporal_layers_, 2);
83 } 89 }
84 90
85 ScreenshareLayers::~ScreenshareLayers() { 91 ScreenshareLayers::~ScreenshareLayers() {
86 UpdateHistograms(); 92 UpdateHistograms();
87 } 93 }
88 94
89 int ScreenshareLayers::CurrentLayerId() const { 95 int ScreenshareLayers::CurrentLayerId() const {
90 // Codec does not use temporal layers for screenshare. 96 // Codec does not use temporal layers for screenshare.
91 return 0; 97 return 0;
92 } 98 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.Layer1.Qp", 413 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.Layer1.Qp",
408 stats_.tl1_qp_sum_ / stats_.num_tl1_frames_); 414 stats_.tl1_qp_sum_ / stats_.num_tl1_frames_);
409 RTC_HISTOGRAM_COUNTS_10000( 415 RTC_HISTOGRAM_COUNTS_10000(
410 "WebRTC.Video.Screenshare.Layer1.TargetBitrate", 416 "WebRTC.Video.Screenshare.Layer1.TargetBitrate",
411 stats_.tl1_target_bitrate_sum_ / stats_.num_tl1_frames_); 417 stats_.tl1_target_bitrate_sum_ / stats_.num_tl1_frames_);
412 } 418 }
413 } 419 }
414 } 420 }
415 421
416 } // namespace webrtc 422 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698