~ubuntu-branches/ubuntu/feisty/gst-plugins-good0.10/feisty-security

« back to all changes in this revision

Viewing changes to gst/rtp/gstrtppcmapay.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-08-15 02:58:26 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060815025826-h1sa4q0uxwqgzwki
Tags: 0.10.4-0ubuntu1
* Sync with Debian (pkg-gstreamer SVN, rev 470):
  + debian/rules,
    debian/control.in:
    - Add a -dbg package again

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * This library is distributed in the hope that it will be useful,
12
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Library General Public License for more 
 
14
 * Library General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Library General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02111-1307, USA.
15
20
 */
16
21
 
17
22
#ifdef HAVE_CONFIG_H
124
129
}
125
130
 
126
131
static GstFlowReturn
127
 
gst_rtp_pcma_pay_flush (GstRtpPmcaPay * rtppcmapay)
 
132
gst_rtp_pcma_pay_flush (GstRtpPmcaPay * rtppcmapay, guint32 clock_rate)
128
133
{
129
134
  guint avail;
130
135
  GstBuffer *outbuf;
136
141
    /* calculate octet count with:
137
142
       maxptime-nsec * samples-per-sec / nsecs-per-sec * octets-per-sample */
138
143
    maxptime_octets =
139
 
        GST_BASE_RTP_PAYLOAD (rtppcmapay)->max_ptime *
140
 
        GST_BASE_RTP_PAYLOAD (rtppcmapay)->clock_rate / GST_SECOND;
 
144
        gst_util_uint64_scale_int (GST_BASE_RTP_PAYLOAD (rtppcmapay)->max_ptime,
 
145
        clock_rate, GST_SECOND);
141
146
  }
142
147
 
143
148
  /* the data available in the adapter is either smaller
176
181
 
177
182
    GST_BUFFER_TIMESTAMP (outbuf) = rtppcmapay->first_ts;
178
183
    ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtppcmapay), outbuf);
 
184
 
 
185
    /* increase count (in ts) of data pushed to basertppayload */
 
186
    rtppcmapay->first_ts +=
 
187
        gst_util_uint64_scale_int (payload_len, GST_SECOND, clock_rate);
 
188
 
 
189
    /* store amount of unpushed data (in ts) */
 
190
    rtppcmapay->duration =
 
191
        gst_util_uint64_scale_int (avail, GST_SECOND, clock_rate);
179
192
  }
180
193
 
181
194
  return ret;
189
202
  guint size, packet_len, avail;
190
203
  GstFlowReturn ret;
191
204
  GstClockTime duration;
 
205
  guint32 clock_rate;
192
206
 
193
207
  rtppcmapay = GST_RTP_PCMA_PAY (basepayload);
194
208
 
 
209
  clock_rate = basepayload->clock_rate;
 
210
 
195
211
  size = GST_BUFFER_SIZE (buffer);
196
 
  duration = GST_BUFFER_TIMESTAMP (buffer);
 
212
  duration = gst_util_uint64_scale_int (size, GST_SECOND, clock_rate);
197
213
 
198
214
  avail = gst_adapter_available (rtppcmapay->adapter);
199
215
  if (avail == 0) {
208
224
   * have. */
209
225
  if (gst_basertppayload_is_filled (basepayload,
210
226
          packet_len, rtppcmapay->duration + duration)) {
211
 
    ret = gst_rtp_pcma_pay_flush (rtppcmapay);
212
 
    rtppcmapay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
213
 
    rtppcmapay->duration = 0;
 
227
    ret = gst_rtp_pcma_pay_flush (rtppcmapay, clock_rate);
 
228
    /* note: first_ts and duration updated in ...pay_flush() */
214
229
  } else {
215
230
    ret = GST_FLOW_OK;
216
231
  }