Fix flush glitch, add artwork request to metadata set.
This commit is contained in:
@@ -395,6 +395,15 @@ void command_stop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this is for reading an unsigned 32 bit number, such as an RTP timestamp
|
||||
|
||||
uint32_t uatoi(const char *nptr) {
|
||||
uint64_t llint = atoll(nptr);
|
||||
uint32_t r = llint;
|
||||
return r;
|
||||
}
|
||||
|
||||
// Given a volume (0 to -30) and high and low attenuations available in the mixer in dB, return an attenuation depending on the volume and the function's transfer function
|
||||
// See http://tangentsoft.net/audio/atten.html for data on good attenuators.
|
||||
// We want a smooth attenuation function, like, for example, the ALPS RK27 Potentiometer transfer functions referred to at the link above.
|
||||
|
||||
@@ -93,8 +93,14 @@ double vol2attn(double vol, long max_db, long min_db);
|
||||
|
||||
uint64_t get_absolute_time_in_fp(void);
|
||||
|
||||
// this is for reading an unsigned 32 bit number, such as an RTP timestamp
|
||||
|
||||
uint32_t uatoi(const char *nptr);
|
||||
|
||||
shairport_cfg config;
|
||||
char sender_name[1024];
|
||||
char sender_ip[1024];
|
||||
char album_name[1024]; // we might need this for picture diagnostics
|
||||
|
||||
void command_start(void);
|
||||
void command_stop(void);
|
||||
|
||||
@@ -13,7 +13,9 @@ typedef struct {
|
||||
void (*mdns_unregister)(void);
|
||||
} mdns_backend;
|
||||
|
||||
#define MDNS_RECORD_WITH_METADATA "tp=UDP", "sm=false", "ek=1", "et=0,1", "cn=0,1", "ch=2", "md=0,1", \
|
||||
// text and progress only -- picture feed really buggy from iTunes
|
||||
|
||||
#define MDNS_RECORD_WITH_METADATA "tp=UDP", "sm=false", "ek=1", "et=0,1", "cn=0,1", "ch=2", "md=0,1,2", \
|
||||
"ss=16", "sr=44100", "vn=3", "txtvers=1", \
|
||||
config.password ? "pw=true" : "pw=false"
|
||||
|
||||
|
||||
@@ -306,11 +306,11 @@ void player_put_packet(seq_t seqno,uint32_t timestamp, uint8_t *data, int len) {
|
||||
time_of_last_audio_packet = get_absolute_time_in_fp();
|
||||
if (connection_state_to_output) { // if we are supposed to be processing these packets
|
||||
|
||||
if ((flush_rtp_timestamp!=0x7fffffff) && ((timestamp==flush_rtp_timestamp) || seq32_order(timestamp,flush_rtp_timestamp))) {
|
||||
if ((flush_rtp_timestamp!=0) && ((timestamp==flush_rtp_timestamp) || seq32_order(timestamp,flush_rtp_timestamp))) {
|
||||
debug(2,"Dropping flushed packet in player_put_packet, seqno %u, timestamp %u, flushing to timestamp: %u.",seqno,timestamp,flush_rtp_timestamp);
|
||||
} else {
|
||||
if ((flush_rtp_timestamp!=0x7fffffff) && (!seq32_order(timestamp,flush_rtp_timestamp))) // if we have gone past the flush boundary time
|
||||
flush_rtp_timestamp=0x7fffffff;
|
||||
if ((flush_rtp_timestamp!=0x0) && (!seq32_order(timestamp,flush_rtp_timestamp))) // if we have gone past the flush boundary time
|
||||
flush_rtp_timestamp=0x0;
|
||||
|
||||
abuf_t *abuf = 0;
|
||||
|
||||
@@ -460,16 +460,16 @@ static abuf_t *buffer_get_frame(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((flush_rtp_timestamp!=0x7fffffff) && ((curframe->timestamp==flush_rtp_timestamp) || seq32_order(curframe->timestamp,flush_rtp_timestamp))) {
|
||||
if ((flush_rtp_timestamp!=0) && ((curframe->timestamp==flush_rtp_timestamp) || seq32_order(curframe->timestamp,flush_rtp_timestamp))) {
|
||||
debug(1,"Dropping flushed packet seqno %u, timestamp %u",curframe->sequence_number,curframe->timestamp);
|
||||
curframe->ready=0;
|
||||
flush_limit++;
|
||||
ab_read=SUCCESSOR(ab_read);
|
||||
}
|
||||
if ((flush_rtp_timestamp!=0x7fffffff) && (!seq32_order(curframe->timestamp,flush_rtp_timestamp))) // if we have gone past the flush boundary time
|
||||
flush_rtp_timestamp=0x7fffffff;
|
||||
if ((flush_rtp_timestamp!=0) && (!seq32_order(curframe->timestamp,flush_rtp_timestamp))) // if we have gone past the flush boundary time
|
||||
flush_rtp_timestamp=0;
|
||||
}
|
||||
} while ((flush_rtp_timestamp!=0x7fffffff) && (flush_limit<=8820) && (curframe->ready==0));
|
||||
} while ((flush_rtp_timestamp!=0) && (flush_limit<=8820) && (curframe->ready==0));
|
||||
|
||||
if (flush_limit==8820) {
|
||||
debug(1,"Flush hit the 8820 frame limit!");
|
||||
@@ -805,7 +805,7 @@ static void *player_thread_func(void *arg) {
|
||||
|
||||
late_packet_message_sent=0;
|
||||
missing_packets=late_packets=too_late_packets=resend_requests=0;
|
||||
flush_rtp_timestamp=0x7fffffff; // it seems this number has a special significance -- it seems to be used as a null operand, so we'll use it like that too
|
||||
flush_rtp_timestamp=0; // it seems this number has a special significance -- it seems to be used as a null operand, so we'll use it like that too
|
||||
int sync_error_out_of_bounds = 0; // number of times in a row that there's been a serious sync error
|
||||
while (!please_stop) {
|
||||
abuf_t *inframe = buffer_get_frame();
|
||||
@@ -1073,10 +1073,10 @@ void player_volume(double f) {
|
||||
}
|
||||
|
||||
void player_flush(uint32_t timestamp) {
|
||||
// debug(1,"Flush requested up to %u. It seems as if 2147483647 is special.",timestamp);
|
||||
// debug(1,"Flush requested up to %u. It seems as if 0 is special.",timestamp);
|
||||
pthread_mutex_lock(&flush_mutex);
|
||||
flush_requested=1;
|
||||
//if (timestamp!=0x7fffffff)
|
||||
//if (timestamp!=0)
|
||||
flush_rtp_timestamp=timestamp; // flush all packets up to (and including?) this
|
||||
pthread_mutex_unlock(&flush_mutex);
|
||||
send_ssnc_metadata('pfls',NULL,0,1);
|
||||
|
||||
@@ -638,7 +638,7 @@ static void handle_flush(rtsp_conn_info *conn,
|
||||
if (p) {
|
||||
p = strchr(p, '=') + 1;
|
||||
if (p)
|
||||
rtptime = atoi(p);
|
||||
rtptime = uatoi(p); // unsigned integer -- up to 2^32-1
|
||||
}
|
||||
}
|
||||
// debug(1,"RTSP Flush Requested.");
|
||||
|
||||
+1642
File diff suppressed because it is too large
Load Diff
+1644
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user