Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make ToxAV independent of toxcore internals. #2651

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Feb 7, 2024

This change is Reviewable

@iphydf iphydf added this to the v0.2.19 milestone Feb 7, 2024
@iphydf iphydf marked this pull request as ready for review February 7, 2024 22:48
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: Patch coverage is 58.29596% with 186 lines in your changes are missing coverage. Please review.

Project coverage is 73.04%. Comparing base (102a1fa) to head (62159e2).

Files Patch % Lines
toxav/msi.c 55.40% 66 Missing ⚠️
toxav/rtp.c 57.14% 54 Missing ⚠️
toxav/toxav.c 71.90% 34 Missing ⚠️
toxav/bwcontroller.c 15.15% 28 Missing ⚠️
toxcore/tox.c 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2651      +/-   ##
==========================================
- Coverage   73.08%   73.04%   -0.04%     
==========================================
  Files         149      149              
  Lines       30531    30479      -52     
==========================================
- Hits        22313    22264      -49     
+ Misses       8218     8215       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iphydf iphydf force-pushed the toxav-public-api branch 2 times, most recently from e59814d to 8a4092b Compare February 9, 2024 02:34
@iphydf
Copy link
Member Author

iphydf commented Feb 11, 2024

This is ready for review.

toxcore/tox.c Outdated Show resolved Hide resolved
toxav/toxav.c Outdated Show resolved Hide resolved
Copy link
Member

@Green-Sky Green-Sky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toxav_old.c uses the Messenger logger, instead the ToxAV logger.

edit: I see that they are still more tightly coupled to messenger and conferences. Maybe we just remove them for v0.3 ?

toxav/video.h Outdated Show resolved Hide resolved
toxav/audio.h Outdated Show resolved Hide resolved
toxav/audio.h Outdated Show resolved Hide resolved
toxav/rtp.c Outdated Show resolved Hide resolved
toxav/rtp.c Outdated Show resolved Hide resolved
free(session);
return nullptr;
}

// First entry is free.
session->work_buffer_list->next_free_entry = 0;

session->ssrc = payload_type == RTP_TYPE_VIDEO ? 0 : random_u32(m->rng);
session->ssrc = payload_type == RTP_TYPE_VIDEO ? 0 : rtp_random_u32(); // Zoff: what is this??
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to https://www.rfc-editor.org/rfc/rfc3550 , this is used to disambiguate multiple sessions. However we don't use this (yet?).

rc = TOXAV_ERR_NEW_MALLOC;
goto RETURN;
}

av->log = tox->m->log;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh


if (length - 1 != sizeof(struct BWCMessage)) {
return -1;
LOGGER_ERROR(log, "Actual data size and length argument do not match");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(struct xxx) is an unreliable number that's implementation defined. We want 2 u32 instead.

Also, the log reads kinda wrong.

#ifndef TOXAV_DEFINED
#define TOXAV_DEFINED
typedef struct ToxAV ToxAV;
#endif /* TOXAV_DEFINED */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are including toxav_hacks.h which provides functions that already need this, so it is safe to assume this already exists here.

int msi_invite(MSISession *session, MSICall **call, uint32_t friend_number, uint8_t capabilities)

/*
* return true if friend was offline and the call was canceled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is offline.

@@ -5,19 +5,24 @@
#ifndef C_TOXCORE_TOXAV_BWCONTROLLER_H
#define C_TOXCORE_TOXAV_BWCONTROLLER_H

#include "../toxcore/Messenger.h"
#include <stdint.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard headers always after your own headers.

@@ -3288,6 +3288,9 @@ bool tox_friend_send_lossless_packet(
Tox_Err_Friend_Custom_Packet *error);

/**
* tox_callback_friend_lossy_packet is the compatibility function to
* set callback for all packet IDs except those reserved for ToxAV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

typedef void m_msi_packet_cb(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t length,
void *user_data);
typedef int m_lossy_rtp_packet_cb(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t length, void *object);
typedef int m_lossy_rtp_packet_cb(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t len, void *object);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len? -> length

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants