Skip to content

Commit 07be62e

Browse files
address mr comments
1 parent bd95181 commit 07be62e

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

user_timestamped_video/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ LIVEKIT_URL=ws://localhost:7880 LIVEKIT_TOKEN=<consumer-token> ./UserTimestamped
2020
Flags:
2121

2222
- Producer default: sends user timestamps
23+
- Producer `--with-user-timestamp`: explicitly sends user timestamps
2324
- Producer `--without-user-timestamp`: does not send user timestamps
2425
- Consumer default: reads user timestamps through `setOnVideoFrameEventCallback`
25-
- Consumer `--ignore-user-timestamp`: ignores metadata through the legacy
26+
- Consumer `--with-user-timestamp`: explicitly reads user timestamps through
27+
`setOnVideoFrameEventCallback`
28+
- Consumer `--without-user-timestamp`: ignores metadata through the legacy
2629
`setOnVideoFrameCallback`
2730

2831
Matrix:
@@ -34,11 +37,11 @@ Matrix:
3437

3538
# 2. Producer sends, consumer ignores
3639
./UserTimestampedVideoProducer
37-
./UserTimestampedVideoConsumer --ignore-user-timestamp
40+
./UserTimestampedVideoConsumer --without-user-timestamp
3841

3942
# 3. Producer does not send, consumer ignores
4043
./UserTimestampedVideoProducer --without-user-timestamp
41-
./UserTimestampedVideoConsumer --ignore-user-timestamp
44+
./UserTimestampedVideoConsumer --without-user-timestamp
4245

4346
# 4. Producer does not send, consumer reads
4447
./UserTimestampedVideoProducer --without-user-timestamp

user_timestamped_video/consumer/main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
/// with `UserTimestampedVideoProducer` running in another process.
2222
///
2323
/// Usage:
24-
/// UserTimestampedVideoConsumer <ws-url> <token> [--ignore-user-timestamp]
24+
/// UserTimestampedVideoConsumer <ws-url> <token>
25+
/// [--with-user-timestamp|--without-user-timestamp]
2526
///
2627
/// Or via environment variables:
2728
/// LIVEKIT_URL, LIVEKIT_TOKEN
@@ -66,11 +67,11 @@ formatUserTimestamp(const std::optional<VideoFrameMetadata> &metadata) {
6667

6768
void printUsage(const char *program) {
6869
std::cerr << "Usage:\n"
69-
<< " " << program
70-
<< " <ws-url> <token> [--ignore-user-timestamp]\n"
70+
<< " " << program << " <ws-url> <token> "
71+
<< "[--with-user-timestamp|--without-user-timestamp]\n"
7172
<< "or:\n"
7273
<< " LIVEKIT_URL=... LIVEKIT_TOKEN=... " << program
73-
<< " [--ignore-user-timestamp]\n";
74+
<< " [--with-user-timestamp|--without-user-timestamp]\n";
7475
}
7576

7677
bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
@@ -83,11 +84,11 @@ bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
8384
if (arg == "-h" || arg == "--help") {
8485
return false;
8586
}
86-
if (arg == "--ignore-user-timestamp") {
87+
if (arg == "--without-user-timestamp") {
8788
read_user_timestamp = false;
8889
continue;
8990
}
90-
if (arg == "--read-user-timestamp") {
91+
if (arg == "--with-user-timestamp") {
9192
read_user_timestamp = true;
9293
continue;
9394
}

user_timestamped_video/producer/main.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
/// timestamps flowing end to end.
2323
///
2424
/// Usage:
25-
/// UserTimestampedVideoProducer <ws-url> <token> [--without-user-timestamp]
25+
/// UserTimestampedVideoProducer <ws-url> <token>
26+
/// [--with-user-timestamp|--without-user-timestamp]
2627
///
2728
/// Or via environment variables:
2829
/// LIVEKIT_URL, LIVEKIT_TOKEN
@@ -81,11 +82,11 @@ void fillFrame(VideoFrame &frame, std::uint32_t frame_index) {
8182

8283
void printUsage(const char *program) {
8384
std::cerr << "Usage:\n"
84-
<< " " << program
85-
<< " <ws-url> <token> [--without-user-timestamp]\n"
85+
<< " " << program << " <ws-url> <token> "
86+
<< "[--with-user-timestamp|--without-user-timestamp]\n"
8687
<< "or:\n"
8788
<< " LIVEKIT_URL=... LIVEKIT_TOKEN=... " << program
88-
<< " [--without-user-timestamp]\n";
89+
<< " [--with-user-timestamp|--without-user-timestamp]\n";
8990
}
9091

9192
bool parseArgs(int argc, char *argv[], std::string &url, std::string &token,
@@ -199,8 +200,8 @@ int main(int argc, char *argv[]) {
199200
<< " capture_ts_us=" << capture_options.timestamp_us
200201
<< " user_ts_us="
201202
<< (send_user_timestamp
202-
? std::to_string(
203-
*capture_options.metadata->user_timestamp_us)
203+
? std::to_string(*capture_options.metadata
204+
->user_timestamp_us)
204205
: std::string("disabled"))
205206
<< "\n";
206207
}

0 commit comments

Comments
 (0)