Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit cbd2aec

Browse files
author
Chunbo
authored
Merge pull request #11 from taste1981/cloudgaming
fix issues in picture_id populating
2 parents da8eff5 + c9e9e41 commit cbd2aec

File tree

9 files changed

+73
-33
lines changed

9 files changed

+73
-33
lines changed

call/rtp_payload_params.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void PopulateRtpWithCodecSpecifics(const CodecSpecificInfo& info,
7676
h264_header.packetization_mode =
7777
info.codecSpecific.H264.packetization_mode;
7878
rtp->simulcastIdx = info.codecSpecific.H264.simulcast_idx;
79-
rtp->picture_id = info.codecSpecific.H264.picture_id;
79+
h264_header.picture_id = info.codecSpecific.H264.picture_id;
8080
return;
8181
}
8282
case kVideoCodecMultiplex:

media/engine/webrtcvideoengine.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ RtpCapabilities WebRtcVideoEngine::GetCapabilities() const {
597597
// demuxing is completed.
598598
// capabilities.header_extensions.push_back(webrtc::RtpExtension(
599599
// webrtc::RtpExtension::kMidUri, webrtc::RtpExtension::kMidDefaultId));
600+
// Temporal scalability support.
601+
capabilities.header_extensions.push_back(
602+
webrtc::RtpExtension(webrtc::RtpExtension::kPictureIdUri,
603+
webrtc::RtpExtension::kPictureIdDefaultId));
600604
return capabilities;
601605
}
602606

media/engine/webrtcvoiceengine.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,6 @@ RtpCapabilities WebRtcVoiceEngine::GetCapabilities() const {
615615
// demuxing is completed.
616616
// capabilities.header_extensions.push_back(webrtc::RtpExtension(
617617
// webrtc::RtpExtension::kMidUri, webrtc::RtpExtension::kMidDefaultId));
618-
// Temporal scalability support.
619-
capabilities.header_extensions.push_back(
620-
webrtc::RtpExtension(webrtc::RtpExtension::kPictureIdUri,
621-
webrtc::RtpExtension::kPictureIdDefaultId));
622618
return capabilities;
623619
}
624620

modules/audio_processing/audio_processing_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ int AudioProcessingImpl::ProcessStream(const float* const* src,
880880
}
881881

882882
capture_.capture_audio->CopyFrom(src, formats_.api_format.input_stream());
883-
RETURN_ON_ERR(ProcessCaptureStreamLocked());
883+
//RETURN_ON_ERR(ProcessCaptureStreamLocked());
884884
capture_.capture_audio->CopyTo(formats_.api_format.output_stream(), dest);
885885

886886
if (aec_dump_) {

modules/pacing/paced_sender.cc

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
namespace {
3434
// Time limit in milliseconds between packet bursts.
3535
const int64_t kMinPacketLimitMs = 5;
36-
const int64_t kMinPacketLimitLowLatency = 1; // For low latency mode we set process interval to 1ms instead.
36+
const int64_t kMinPacketLimitLowLatency =
37+
1; // For low latency mode we set process interval to 1ms instead.
3738
const int64_t kCongestedPacketIntervalMs = 500;
3839
const int64_t kPausedProcessIntervalMs = kCongestedPacketIntervalMs;
3940
const int64_t kMaxElapsedTimeMs = 2000;
@@ -48,6 +49,7 @@ namespace webrtc {
4849

4950
const int64_t PacedSender::kMaxQueueLengthMs = 2000;
5051
const float PacedSender::kDefaultPaceMultiplier = 2.5f;
52+
const char kLogLatencyToFileFieldTrial[] = "OWT-Log-Latency-To-File";
5153

5254
int64_t capture_timestamp = 0;
5355
int64_t end_timestamp = 0;
@@ -96,14 +98,21 @@ PacedSender::PacedSender(const Clock* clock,
9698
UpdateBudgetWithElapsedTime(kMinPacketLimitMs);
9799
if (low_latency_mode_)
98100
prober_->SetEnabled(false);
99-
recorder = fopen("pacer.txt", "a+");
101+
recorder = nullptr;
102+
if (webrtc::field_trial::IsEnabled(kLogLatencyToFileFieldTrial))
103+
recorder = fopen("pacer.txt", "a+");
100104
}
101105

102-
PacedSender::~PacedSender() {}
106+
PacedSender::~PacedSender() {
107+
if (recorder != nullptr) {
108+
fclose(recorder);
109+
recorder = nullptr;
110+
}
111+
}
103112

104113
void PacedSender::CreateProbeCluster(int bitrate_bps) {
105114
rtc::CritScope cs(&critsect_);
106-
if (!low_latency_mode_) // Do not create probe cluster on low latency mode.
115+
if (!low_latency_mode_) // Do not create probe cluster on low latency mode.
107116
prober_->CreateProbeCluster(bitrate_bps, clock_->TimeInMilliseconds());
108117
}
109118

@@ -300,7 +309,7 @@ void PacedSender::Process() {
300309
// congested state due to no feedback being received.
301310
int64_t elapsed_since_last_send_us = now_us - last_send_time_us_;
302311
if (elapsed_since_last_send_us >= kCongestedPacketIntervalMs * 1000) {
303-
// We can not send padding unless a normal packet has first been sent. If
312+
// We do not send padding unless a normal packet has first been sent. If
304313
// we do, timestamps get messed up.
305314
if (packet_counter_ > 0) {
306315
PacedPacketInfo pacing_info;
@@ -311,7 +320,7 @@ void PacedSender::Process() {
311320
}
312321
if (paused_) {
313322
RTC_LOG(LS_ERROR) << "Paused.";
314-
//return;
323+
// return;
315324
}
316325

317326
if (elapsed_time_ms > 0) {
@@ -362,21 +371,24 @@ void PacedSender::Process() {
362371
<< ",sz: " << packet.bytes
363372
<< ", q: " << packets_->SizeInPackets();
364373

365-
if (capture_timestamp != packet.capture_time_ms) { // New frame
366-
int64_t last_frame_cost = end_timestamp - capture_timestamp;
367-
int64_t time_since_last_frame =
368-
clock_->TimeInMilliseconds() - end_timestamp;
369-
fprintf(recorder, "%lld\t%lld\t%zd\t%lld\n", frame_count, last_frame_cost,
370-
total_size, time_since_last_frame);
371-
frame_count++;
372-
total_size = 0;
373-
end_timestamp = clock_->TimeInMilliseconds();
374-
capture_timestamp = packet.capture_time_ms;
375-
} else {
376-
capture_timestamp = packet.capture_time_ms;
377-
total_size += packet.bytes;
378-
end_timestamp = clock_->TimeInMilliseconds();
379-
}
374+
if (webrtc::field_trial::IsEnabled(kLogLatencyToFileFieldTrial)) {
375+
if (capture_timestamp != packet.capture_time_ms) { // New frame
376+
int64_t last_frame_cost = end_timestamp - capture_timestamp;
377+
int64_t time_since_last_frame =
378+
clock_->TimeInMilliseconds() - end_timestamp;
379+
fprintf(recorder, "%lld\t%lld\t%zd\t%lld\n", frame_count,
380+
last_frame_cost, total_size, time_since_last_frame);
381+
frame_count++;
382+
total_size = 0;
383+
end_timestamp = clock_->TimeInMilliseconds();
384+
capture_timestamp = packet.capture_time_ms;
385+
} else {
386+
capture_timestamp = packet.capture_time_ms;
387+
total_size += packet.bytes;
388+
end_timestamp = clock_->TimeInMilliseconds();
389+
}
390+
}
391+
380392
if (is_probing && bytes_sent > recommended_probe_size)
381393
break;
382394
} else {
@@ -389,12 +401,12 @@ void PacedSender::Process() {
389401

390402
if (!IsLowLatencyMode()) {
391403
if (packets_->Empty() && !Congested()) {
392-
// We can not send padding unless a normal packet has first been sent. If we
393-
// do, timestamps get messed up.
404+
// We can not send padding unless a normal packet has first been sent. If
405+
// we do, timestamps get messed up.
394406
if (packet_counter_ > 0) {
395407
int padding_needed =
396408
static_cast<int>(is_probing ? (recommended_probe_size - bytes_sent)
397-
: padding_budget_->bytes_remaining());
409+
: padding_budget_->bytes_remaining());
398410
if (padding_needed > 0) {
399411
bytes_sent += SendPadding(padding_needed, pacing_info);
400412
}
@@ -422,9 +434,10 @@ bool PacedSender::SendPacket(const PacketQueueInterface::Packet& packet,
422434
bool apply_pacing =
423435
!audio_packet || account_for_audio_ || video_blocks_audio_;
424436
if (!IsLowLatencyMode()) {
425-
if (apply_pacing && (Congested() || (media_budget_->bytes_remaining() == 0 &&
426-
pacing_info.probe_cluster_id ==
427-
PacedPacketInfo::kNotAProbe))) {
437+
if (apply_pacing &&
438+
(Congested() ||
439+
(media_budget_->bytes_remaining() == 0 &&
440+
pacing_info.probe_cluster_id == PacedPacketInfo::kNotAProbe))) {
428441
return false;
429442
}
430443
}

modules/video_coding/timing.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "rtc_base/time/timestamp_extrapolator.h"
1616
#include "system_wrappers/include/clock.h"
17+
#include "system_wrappers/include/field_trial.h"
18+
#include "system_wrappers/include/runtime_enabled_features.h"
1719

1820
namespace webrtc {
1921

@@ -173,6 +175,10 @@ int64_t VCMTiming::RenderTimeMs(uint32_t frame_timestamp,
173175

174176
int64_t VCMTiming::RenderTimeMsInternal(uint32_t frame_timestamp,
175177
int64_t now_ms) const {
178+
// For low latency mode, render immediately
179+
if (webrtc::field_trial::IsEnabled(runtime_enabled_features::kLowLatencyMode)) {
180+
return 0;
181+
}
176182
if (min_playout_delay_ms_ == 0 && max_playout_delay_ms_ == 0) {
177183
// Render as soon as possible.
178184
return 0;

system_wrappers/include/runtime_enabled_features.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace webrtc {
2626
namespace runtime_enabled_features {
2727

2828
const char kDualStreamModeFeatureName[] = "WebRtcDualStreamMode";
29+
const char kLowLatencyMode[] = "OWT-LowLatencyMode";
2930

3031
bool IsFeatureEnabled(std::string feature_name);
3132

video/video_receive_stream.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ VideoCodec CreateDecoderVideoCodec(const VideoReceiveStream::Decoder& decoder) {
8282

8383
namespace internal {
8484

85+
const char kLogLatencyToFileFieldTrial[] = "OWT-Log-Latency-To-File";
86+
87+
bool GetLogLatencyToFileIsFieldTrialEnabled() {
88+
return webrtc::field_trial::IsEnabled(kLogLatencyToFileFieldTrial);
89+
}
90+
8591
VideoReceiveStream::VideoReceiveStream(
8692
RtpStreamReceiverControllerInterface* receiver_controller,
8793
int num_cpu_cores,
@@ -150,11 +156,20 @@ VideoReceiveStream::VideoReceiveStream(
150156
rtx_receiver_ = receiver_controller->CreateReceiver(
151157
config_.rtp.rtx_ssrc, rtx_receive_stream_.get());
152158
}
159+
recorder_pre_ = nullptr;
160+
if (GetLogLatencyToFileIsFieldTrialEnabled()) {
161+
char dump_file_name[128];
162+
snprintf(dump_file_name, 128, "pre_decode_vrs-%p.txt", this);
163+
recorder_pre_ = fopen(dump_file_name, "w+");
164+
}
153165
}
154166

155167
VideoReceiveStream::~VideoReceiveStream() {
156168
RTC_DCHECK_CALLED_SEQUENTIALLY(&worker_sequence_checker_);
157169
RTC_LOG(LS_INFO) << "~VideoReceiveStream: " << config_.ToString();
170+
if (recorder_pre_ != nullptr) {
171+
fclose(recorder_pre_);
172+
}
158173
Stop();
159174

160175
process_thread_->DeRegisterModule(&rtp_stream_sync_);
@@ -416,6 +431,10 @@ bool VideoReceiveStream::Decode() {
416431

417432
if (frame) {
418433
int64_t now_ms = clock_->TimeInMilliseconds();
434+
if (recorder_pre_ != nullptr) {
435+
int32_t frame_ts = frame->Timestamp();
436+
fprintf(recorder_pre_, "%d\t%lld\n", frame_ts, now_ms);
437+
}
419438
RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kFrameFound);
420439
int decode_result = video_receiver_.Decode(frame.get());
421440
if (decode_result == WEBRTC_VIDEO_CODEC_OK ||

video/video_receive_stream.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class VideoReceiveStream : public webrtc::VideoReceiveStream,
160160
bool frame_decoded_ = false;
161161

162162
int64_t last_keyframe_request_ms_ = 0;
163+
FILE* recorder_pre_;
163164
};
164165
} // namespace internal
165166
} // namespace webrtc

0 commit comments

Comments
 (0)